IndentationError: unexpected indent
字符缩进问题,可能是缩进格式不对,或者有空格。建议改用Tab标准缩进
SyntaxError: invalid syntax
使用python关键字作为变量
SyntaxError: Missing parentheses in call to 'print'
源码为2.x环境,当前运行环境为3.x。在2.x中print函数为 print “text”,3.x中
改为 print(“text”)
inconsistent use of tabs and spaces in indentation
空格与Tab混用,统一用Tab或4个空格
POST data should be bytes, an iterable of bytes, or a file object. It cannot be
of type str.
在urlencode语句后加encode(encoding=’UTF8’)
TypeError: a bytes-like object is required, not 'str'
字符串前增加b将str转换为bytes
local variable 'varirable' referenced before assignment
声明变量之前就已经对其进行了调用
'bytes' object has no attribute 'encode'