https://github.com/python/cpython
Revision aac875fa2f03cab61ceeaa2621c4c5534c7bcfc2 authored by Serhiy Storchaka on 12 March 2017, 19:52:17 UTC, committed by GitHub on 12 March 2017, 19:52:17 UTC
if attributes "encoding" or "errors" of sys.stdin or sys.stdout are not set or are not strings.
1 parent c609484
Raw File
Tip revision: aac875fa2f03cab61ceeaa2621c4c5534c7bcfc2 authored by Serhiy Storchaka on 12 March 2017, 19:52:17 UTC
[3.6] bpo-8256: Fixed possible failing or crashing input() (#641)
Tip revision: aac875f
antigravity.py

import webbrowser
import hashlib

webbrowser.open("https://xkcd.com/353/")

def geohash(latitude, longitude, datedow):
    '''Compute geohash() using the Munroe algorithm.

    >>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
    37.857713 -122.544543

    '''
    # http://xkcd.com/426/
    h = hashlib.md5(datedow).hexdigest()
    p, q = [('%f' % float.fromhex('0.' + x)) for x in (h[:16], h[16:32])]
    print('%d%s %d%s' % (latitude, p[1:], longitude, q[1:]))
back to top