import zipfile,re
open_zip=zipfile.ZipFile('channel.zip','r')#在网页源代码里看到zip,打开网址下载channel.zip并放在代码文件母录下。
next_id='90052.txt'
count=1
while True:
data=open_zip.read(next_id)
data=str(data,encoding='utf-8')
data_id=''.join(re.findall('[0-9]*',data))
next_id=str(data_id)+'.txt'
count+=1
print(count,'next is:',next_id)
在最后一个文件中看到Collect the comments.故应收集comments。
import zipfile,re
open_zip=zipfile.ZipFile('channel.zip','r')
next_id='90052.txt'
count=1
comments=[]
str1=''
while True:
data=open_zip.read(next_id)
comments.append(open_zip.getinfo(next_id).comment)
data=str(data,encoding='utf-8')
if data[-1].isdigit():
data_id=''.join(re.findall('[0-9]*',data))
next_id=str(data_id)+'.txt'
count+=1
print(count,'next is:',next_id)
for list in comments:
str1+=str(list,encoding='utf-8')
else:
print(data)
break
print(str1)
得到hockey字样
网址输入得到 it’s in the air. look at the letters.
再看hockey的组成字母oxygen.