- 论坛徽章:
- 0
|
# coding: cp936
"""
查询城市天气情况
信息来源网 weather.news.sohu.com
Author : 寒江风
QQ : 84640008
Date : 2006-09-05
"""
import urllib
import re
def main():
# Show Information
print '中国城市天气查询'
# Get Parameters
city = raw_input('请输入您要查询天气的城市名字(如汕头,广州...) : ')
# Request For The Web Page
params = urllib.urlencode({'city':city})
webpage = urllib.urlopen('http://weather.news.sohu.com/city_inc.php?%s' % params)
webdata = webpage.read().replace('\n', '')
# Match The Useful Information
pattern = re.compile('([^
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/22660/showart_164945.html |
|