funny_python 01 import antigravity

在Python裏面import antigravity 會發現另外一個小彩蛋 python

Tada~ git

其實就是打開了xkcd的一個python主題漫畫 web

鼠標停留在圖片上,還會看到標題:小程序

「I wrote 20 short programs in Python yesterday. It was wonderful. Perl, I'm leaving you. 我昨天用Python寫了20個小程序,感受爽的飛起來了~ Perl 我不要你了。。。」  spa

好傲嬌的感受 code

PYTHON

最後附上源碼:blog

 1 import webbrowser
 2 import hashlib
 3 
 4 webbrowser.open("http://xkcd.com/353/")
 5 
 6 def geohash(latitude, longitude, datedow):
 7     '''Compute geohash() using the Munroe algorithm.
 8 
 9     >>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
10     37.857713 -122.544543
11 
12     '''
13     # http://xkcd.com/426/
14     h = hashlib.md5(datedow).hexdigest()
15     p, q = [('%f' % float.fromhex('0.' + x)) for x in (h[:16], h[16:32])]
16     print('%d%s %d%s' % (latitude, p[1:], longitude, q[1:]))
相關文章
相關標籤/搜索