download the zip file from ..../channel.zip
extract the channel.zip and read the read.txt
my code:
>>> import re
>>> value=90052
>>> comments=[]
>>> z=zipfile.ZipFile('/home/gaoy/Downloads/channel.zip')
>>> while True:
f=open('/home/gaoy/temp/%s'%value+'.txt')
comments.append(z.getinfo('%s'%value+'.txt').comment)
m=re.search('[0-9]+',f.read())
f.close()
if value:
value=m.group(0)
print value
else:
print value
break;
redundancy!
########################################3
better reference code:
while True:
content=z.read('%s.txt'%value)
comments.append(z.getinfo('%s.txt'%value).comment)
match=findNothing(content)
if match:
value=match.group(0)
else:
break
print content
the final step:
print ''.join(comments)
###################################
the answer is oxygen.html (H-->o,O-->x,C--y,K-->g,E-->e,Y--n)
extract the channel.zip and read the read.txt
my code:
>>> import re
>>> value=90052
>>> comments=[]
>>> z=zipfile.ZipFile('/home/gaoy/Downloads/channel.zip')
>>> while True:
f=open('/home/gaoy/temp/%s'%value+'.txt')
comments.append(z.getinfo('%s'%value+'.txt').comment)
m=re.search('[0-9]+',f.read())
f.close()
if value:
value=m.group(0)
print value
else:
print value
break;
redundancy!
########################################3
better reference code:
while True:
content=z.read('%s.txt'%value)
comments.append(z.getinfo('%s.txt'%value).comment)
match=findNothing(content)
if match:
value=match.group(0)
else:
break
print content
the final step:
print ''.join(comments)
###################################
the answer is oxygen.html (H-->o,O-->x,C--y,K-->g,E-->e,Y--n)
本文介绍了一种使用Python进行文件解压并利用正则表达式从一系列文本中提取数字的方法。通过循环读取ZIP文件中的每个文本文件,解析内容并找到新的文件名,最终收集所有文件的注释部分组成答案。
1418

被折叠的 条评论
为什么被折叠?



