- 帖子
- 2
- 精华
- 0
- 积分
- 6
- 阅读权限
- 10
- 注册时间
- 2016-7-22
- 最后登录
- 2016-7-22
|
老师老师我沉船了
为了节省咱的空间我就不发图直接发代码和结果- <div># -*- coding:utf-8 -*-</div><div>import urllib2</div><div>import json</div><div>
- </div><div>from city import city</div><div>cityname = raw_input("你想查询哪个城市的的天气?\n")</div><div>citycode = city.get(cityname)</div><div>
- </div><div>if citycode:</div><div> url = ('http://www.weather.com.cn/data/cityinfo/%s.html' % citycode)</div><div> content = urllib2.urlopen(url).read()</div><div> print content</div>
复制代码 完全一样的代码- <div>Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] on win32</div><div>Type "copyright", "credits" or "license()" for more information.</div><div>>>> ================================ RESTART ================================</div><div>>>> </div><div>
- </div><div>Traceback (most recent call last):</div><div> File "D:/python/demo", line 5, in <module></div><div> from city import city</div><div> File "D:/python\city.py", line 2</div><div>SyntaxError: Non-ASCII character '\xe5' in file D:/python\city.py on line 2, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details</div><div>>>> </div>
复制代码 这个是运行结果~~求老师教教~
|
|