ainila 发表于 2017-4-30 13:07:44

python encode('utf8') problem

url='aa'
print type(url)
print url.encode('utf8')
以上是ok的
keyword="中国"
print keyword.encode("utf8")
就会报错了
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128)


http://img.zemanta.com/pixy.gif?x-id=a190eab4-d6e5-8f28-b00f-87569a115b5c
页: [1]
查看完整版本: python encode('utf8') problem