python报错
1.ValueError: unsupported format character 'D' (0x44) at index 16
string0 = "123456" string = "string%s" %string0 上一句改成:string = "string%s".replace('%s',string0)
2.输出内容到命令行,中文字符是乱码
1>在输出内容后面加上.decode('utf-8')
3.设定了输出的环境为utf8:
import sys reload(sys) sys.setdefaultencoding('utf-8')
4.python上配置代理出错
requests.exceptions.ConnectionError: SOCKSHTTPConnectionPool(host='myhost', port=80):
Max retries exceeded with url: /my/path (Caused by NewConnectionError(
'<requests.packages.urllib3.contrib.socks.SOCKSConnection object at 0x106812bd0>:
Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))
尝试将您的代理网址更改socks5://proxyhost:1234
为socks5h://proxyhost:1234
。注意extra h
(它代表主机名解析)。
转自:https://gxnotes.com/article/222818.html