Created
February 14, 2012 11:43
-
-
Save kgleeson/1826173 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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