时间:2021-07-01 10:21:17 帮助过:37人阅读
import sys, urllib2, urllib zipcode = "S2S 1R8" url = 'http://www.yoursiteweb.com/getForecast' data = urllib.urlencode([('query', zipcode)]) req = urllib2.Request(url) fd = urllib2.urlopen(req, data) while 1: data = fd.read(1024) if not len(data): break sys.stdout.write(data)
希望本文所述对大家的Python程序设计有所帮助。