编码报错,怎么破?
来源:3-2 如何实现可迭代对象和迭代器对象(2)

Lewi
2017-06-12
# -*- coding:utf-8 -*- import requests def getweather(city): r = requests.get(u'http://wthrcdn.etouch.cn/weather_mini?city=' + city) data = r.json()['data']['forecast'][0] return '%s: %s,%s' %(city, data['low'], data['high']) print getweather(u'长春')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef >>> import sys >>> sys.getdefaultencoding() 'ascii'
写回答
1回答
-
程序员硕
2017-06-12
哪里运行的?
122017-06-12
相似问题