- 帖子
- 4
- 精华
- 0
- 积分
- 26
- 阅读权限
- 10
- 注册时间
- 2018-5-31
- 最后登录
- 2018-6-14
|
crossin先生,你好:
下面报错,怎么解决。
python3.5:
Traceback (most recent call last):
File "D:\workspace\less\test2\weather_tst1.py", line 5, in <module>
from city import city
File "D:\workspace\less\test2\city.py", line 2
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xb1 in position 0: invalid start byte- # coding=utf-8
- import urllib.request
- import json
- from city import city
- cityName=input('哪个城市?\n')
- cityCode=city.get(cityName)
- if cityCode:
- url='http://www.weather.com.cn/data/cityinfo/%s.html'%cityCode
- content = urllib.request.urlopen(url).read()
- print(content)
复制代码 |
|