标签类目:多线程

python多线程抓新浪天气的代码

分类:Python

  1. # -*- coding: utf-8 -*-
  2. import os,sys,time,re
  3. from threading import Thread
  4.  
  5. class DownloadWeather(Thread):
  6.     def __init__(self, path, url, num_of_workers=5, timeout = 2):
  7.         Thread.__init__(self)
  8.         self.path = path
  9.         self.url = url
  10.         #self.city = city/var/www/weather/data/' + city
  11.     url='http://weather.sina.com.cn http://php.weather.sina.com.cn/js2.php?city=' +city+ '&time=' +wtime
  12. <a href="http://www.linuxany.com/archives/298.html#more-298" class="more-link">继续阅读 &raquo;</a>

返回顶部