码迷,mamicode.com
首页 > 编程语言 > 详细

pythonchallenge 第六关

时间:2015-04-29 00:12:09      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:

本文完全参考了 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]))  

 

pythonchallenge 第六关

标签:

原文地址:http://www.cnblogs.com/istudy2012/p/4464199.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!