Skip to content

Instantly share code, notes, and snippets.

@kgleeson
Created February 14, 2012 11:43
Show Gist options
  • Save kgleeson/1826173 to your computer and use it in GitHub Desktop.
Save kgleeson/1826173 to your computer and use it in GitHub Desktop.
import re, urllib
def openurl(number):
base_url = "http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing="
url = base_url + str(number)
webpage = urllib.urlopen(url)
body = webpage.read()
if not re.search('^and the next nothing is', body):
print body
return re.search('\d+$', body).group()
counter = 0
number = 12345
while counter < 400:
if number == 16044 or number == '16044':
number = int(number) / 2
number = openurl(number)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment