1 #-*- coding:utf8-*-
2 import time
3 import zipfile
4 import re
5 start = time.time()
6 '''
7 学习 zipfile http://blog.csdn.net/jgood/article/details/4351911
8 '''
9 '''
10 welcome to my zipped list.
11
12 hint1: start from 90052
13 hint2: answer is inside the zip
14 '''
15 prefix = "90052"
16 suffix = ".txt"
17 pattern = "Next nothing is (\d+)"
18 info = ''
19 zip = zipfile.ZipFile("channel.zip","r")
20 data = zip.read("90052.txt")
21 res = re.search(pattern,data)
22 while res:
23 prefix = res.group(1)
24 data = zip.read(prefix+suffix)
25 res = re.search(pattern,data)
26 Info = zip.getinfo(prefix + suffix)
27 info += Info.comment
28 if not res:
29 break
30 print res.group(1)
31 data = zip.read(prefix + suffix)
32 print data
33 print info
34 #Collect the comments.
35 #***************************************************************
36 #****************************************************************
37 #** **
38 #** OO OO XX YYYY GG GG EEEEEE NN NN **
39 #** OO OO XXXXXX YYYYYY GG GG EEEEEE NN NN **
40 #** OO OO XXX XXX YYY YY GG GG EE NN NN **
41 #** OOOOOOOO XX XX YY GGG EEEEE NNNN **
42 #** OOOOOOOO XX XX YY GGG EEEEE NN **
43 #** OO OO XXX XXX YYY YY GG GG EE NN **
44 #** OO OO XXXXXX YYYYYY GG GG EEEEEE NN **
45 #** OO OO XX YYYY GG GG EEEEEE NN **
46 #** **
47 #****************************************************************
48 # **************************************************************
49 #hockey
50 print "耗时:"+str(time.time() - start)