jackyshan

导航

 

2014年2月12日

摘要: importsocket,threading,os,sys,queue,resocket.setdefaulttimeout(5)path=sys.path[0]ifos.path.isfile(path):path=os.path.split(path)[0]domain='www.baidu.com'que=queue.Queue()tno=20a=open(path+r'\proxy.txt').read().strip().split()foriina:que.put(i.split(':'))data='''GE 阅读全文
posted @ 2014-02-12 10:43 jackyshan 阅读(369) 评论(0) 推荐(0) 编辑
 
摘要: python主代码weather.pyimporturllib2importjsonfromcityimportcitycityname=raw_input('你想查哪个城市的天气?\n')citycode=city.get(cityname)ifcitycode:url='http://www.weather.com.cn/data/cityinfo/%s.html'%citycodecontent=urllib2.urlopen(url).read()data=json.loads(content)result=data['weatherinfo&# 阅读全文
posted @ 2014-02-12 10:14 jackyshan 阅读(2114) 评论(0) 推荐(0) 编辑