-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path4.py
More file actions
23 lines (21 loc) · 823 Bytes
/
4.py
File metadata and controls
23 lines (21 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import urllib2,re
r=re.compile(r'.*?(\d+)$')
nextnothing='12345'
i=1
t=True
while t:
try:
f=urllib2.urlopen('http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=%s'% nextnothing)
result=f.read()
f.close()
print i,result
nextnothing=r.search(result).group(1)
if nextnothing=='16044':
nextnothing='8022'
if result=='peak.html':
t=False
i+=1
except:
if result=='peak.html':
t=False
print 'error'