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) |