File tree 2 files changed +41
-0
lines changed 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ #-*- coding:utf-8 -*-
2
+ '''
3
+ Created on 2017年5月9日
4
+
5
+ @author: huangjiaxin
6
+ '''
7
+ from PIL import Image
8
+ import numpy as np
9
+
10
+ def main ():
11
+ im = Image .open ('bell.png' )
12
+ imdata = list (im .getdata ())
13
+ imdata = np .array (imdata )
14
+ size = im .size
15
+ imdata = imdata .reshape ((size [1 ], size [0 ], - 1 ))
16
+ imdata_g = imdata [:, :, 1 ]
17
+ diff = np .abs (imdata_g [:, 0 ::2 ] - imdata_g [:, 1 ::2 ])
18
+ idx = np .where (diff != 42 )
19
+ msg = diff [idx ]
20
+ print '' .join (chr (i ) for i in msg )
21
+ print 'Guido van Rossum' .split ()[0 ]
22
+
23
+ if __name__ == '__main__' :
24
+ main ()
Original file line number Diff line number Diff line change
1
+ #-*- coding:utf-8 -*-
2
+ '''
3
+ Created on 2017年5月9日
4
+
5
+ @author: huangjiaxin
6
+ '''
7
+ import urllib
8
+ import bz2
9
+
10
+ def main ():
11
+ html = urllib .urlopen ('http://repeat:switch@www.pythonchallenge.com/pc/ring/guido.html' ).read ()
12
+ html = html .split ('\n ' )[12 :]
13
+ data = [chr (len (i )) for i in html ]
14
+ print bz2 .decompress ('' .join (data ))
15
+
16
+ if __name__ == '__main__' :
17
+ main ()
You can’t perform that action at this time.
0 commit comments