# -*- coding: UTF-8 -*-
import urllib2
from city import city
exit=False
while not exit:
cityname=raw_input("你想查询哪个城市的天气?输入q退出\n")
if cityname=="q" or cityname=="Q":
print("退出!")
exit=True
else:
citycode=city.get(cityname)
if citycode:
url=("http://www.weather.com.cn/data/cityinfo/%s.html"%citycode)
request=urllib.request.Request(url)
response=urllib.request.urlopen(request)
content=response.read().decode("utf-8")
print(content)