Skip to content

Instantly share code, notes, and snippets.

@lufeihaidao
Created April 13, 2014 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lufeihaidao/10588171 to your computer and use it in GitHub Desktop.
Save lufeihaidao/10588171 to your computer and use it in GitHub Desktop.
Q4 of python challenge
import re
from urllib import urlopen
astring='http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing='
temp='12345'
f = urlopen(astring+temp)
a=f.read()
restring=re.compile('and the next nothing is (\d{3,5})')
for i in range(400):
temp=re.findall(restring,a)[0]
print(temp)
f=urlopen(astring+temp)
a=f.read()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment