python challenge 12

View Code
 1 #-*- coding:utf8-*-
2 import time
3 start = time.time()
4
5 # Get the data from: http://www.pythonchallenge.com/pc/return/evil2.gfx
6
7 h = open("evil2.gfx", "rb")
8 data = h.read()
9 h.close()
10
11 new_data = [[], [], [], [], []]
12 n = 0
13
14 for byte in range(len(data) - 1):
15 new_data[n].append(data[byte])
16 n = 0 if n == 4 else n + 1
17
18 for n, elt in enumerate(new_data):
19 h = open(str(n + 1), "wb")
20 h.write("".join(elt))
21 h.close()
22
23 print "耗时:"+str(time.time() - start)
posted @ 2012-02-10 18:31  lcyang  阅读(221)  评论(0编辑  收藏  举报