标签:lib head decode except python2 exce bool oat code
python2.7 | python 3.6 |
---|---|
import?urllib2 | import?urllib |
import urlparse | import urllib |
import?exceptions | 废弃 |
urllib2.urlopen | urllib.request.urlopen |
urllib2.Request | urllib.request.Request |
urllib.urlencode | urllib.parse.quote |
urllib.urldecode | urllib.parse.unquote |
dict.has_key(xx) | xx in dict |
types.StringType | type(‘‘) |
types.UnicodeType | 废弃 |
types.ListType | type([]) |
types.DictType | type({}) |
types.IntType | type(1) |
types.BooleanType | type(True) |
types.LongType | type(1) |
types.FloatType | type(1.1) |
except Exception,err | except Exception as err |
print xxx | print(xxx) |
记录python2.7迁移到python3.6过程中的一些代码差异
标签:lib head decode except python2 exce bool oat code
原文地址:https://www.cnblogs.com/ahfuzhang/p/11772485.html