Created
June 1, 2012 16:33
-
-
Save fforbeck/2853388 to your computer and use it in GitHub Desktop.
pc04
This file contains 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 urllib2, re, sys | |
uri = 'http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=' | |
nothing = '12345' | |
def get_next(nothing): | |
request = request = urllib2.Request(uri + nothing) | |
result = str(urllib2.urlopen(request).read()) | |
if 'html' in result: | |
print("secret word :D -----> " + result) | |
sys.exit() | |
next_nothing = ''.join(re.findall('\d', ''.join(re.findall('nothing is \d+', result)))) | |
if (next_nothing == ''): | |
next_nothing = str(int(nothing) / 2) | |
return next_nothing | |
i = 0 | |
while (i <= 270): | |
nothing = get_next(nothing) | |
print(nothing) | |
i = i + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment