python多线程抓新浪天气的代码
- # -*- coding: utf-8 -*-
- import os,sys,time,re
- from threading import Thread
- class DownloadWeather(Thread):
- def __init__(self, path, url, num_of_workers=5, timeout = 2):
- Thread.__init__(self)
- self.path = path
- self.url = url
- #self.city = city/var/www/weather/data/' + city
- url='http://weather.sina.com.cn http://php.weather.sina.com.cn/js2.php?city=' +city+ '&time=' +wtime
- <a href="http://www.linuxany.com/archives/298.html#more-298" class="more-link">继续阅读 »</a>
