import urllib2
import zipfile
from StringIO import StringIO
s = urllib2.urlopen("http://www.pythonchallenge.com/pc/def/channel.zip").read()
z = StringIO()
z.write(s)
zipobj = zipfile.ZipFile(z)
#print zipobj.read('readme.txt')
#print zipobj.read('46145.txt')
num = "90052"
out = []
while True:
if num.isdigit():
path = num+'.txt'
t=zipobj.read(path)
num =t.split(' ')[-1]
out.append(zipobj.getinfo(path).comment)
else:
break
zipobj.close()
print ''.join(out)
[pythonchallenge]level6
最新推荐文章于 2017-10-01 07:29:30 发布