1 #-*- coding:utf8-*-
2 import time
3 import re
4 import Image
5 import ImageDraw
6 start = time.time()
7
8 fo = open("10","r+")
9 nums = fo.read()
10 num = ''
11 for i in nums:
12 if i != '\n':
13 num += i
14 nums = []
15 for n in re.findall(r'\d+',num):
16 nums.append(n)
17 print nums
18 pixel = zip(nums[0::2],nums[1::2])
19 print len(pixel)
20 #print pixel
21 #print int(pixel[1][0])*int(pixel[1][1])
22 im = Image.new("RGB",(700,500),1)
23 draw = ImageDraw.Draw(im)
24 for i in xrange(len(pixel)):
25 draw.point((int(pixel[i][0]),int(pixel[i][1])),fill = 188)
26 im.show()
27 #for n in xrange(1,len(nums)-2,2):
28 # i,j = int(nums[n]),int(nums[n+1])
29 # draw.line((j,i),(255,255,255))
30
31
32 #im.show()
33 #pic = Image.open("good.jpg")
34 #print pic.size
35 #for x in xrange(pic.size[0]):
36 # for y in xrange(pic.size[1]):
37 # pic.putpixel((x,y),(255,255,255))
38
39 #for n in xrange(1,len(nums)-2,2):
40 # i,j = int(nums[n]),int(nums[n+1])
41 ## print i,j
42 # pic.putpixel((j,i),(0,0,0))
43
44 #pic.show()
45 print "耗时:"+str(time.time() - start)