本文完全参考了 http://blog.csdn.net/aegeaner/article/details/7932058
import fileinput, re, zipfile idx = 90052 history = [] while True: history.append(idx) with fileinput.input(files=('E:\TDDOWNLOAD\channel\\'+str(idx)+'.txt')) as data: data = data.readline() print("File" + str(idx) + ":\t" + data) idx = "".join(re.findall('[0-9.]', data)) print(len(idx)) if len(idx) == 1: break with zipfile.ZipFile('channel.zip', 'r') as file: print(''.join([file.getinfo(str(i)+'.txt').comment.decode("utf-8") for i in history]))