-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpythontest17.py
More file actions
75 lines (57 loc) · 1.58 KB
/
Copy pathpythontest17.py
File metadata and controls
75 lines (57 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import urllib2
import Cookie
#import cookielib, urllib2
#cj = cookielib.CookieJar()
#opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
#r = opener.open(nexturl)
#myFile = urllib2.urlopen('http://www.pythonchallenge.com//pc/return/romance.html')
#headers = myFile.info()
#cookie = headers.getheader("set-cookie")
#c = Cookie.SimpleCookie(cookie)
#print c["info"].value
nexturl = 'http://www.pythonchallenge.com/pc/def/linkedlist.php?busynothing=12345'
n = '12345'
o = 12345
p = ''
myFile = urllib2.urlopen(nexturl)
headers = myFile.info()
cookie = headers.getheader("set-cookie")
c = Cookie.SimpleCookie(cookie)
print c["info"].value
p = p + c["info"].value
count = 1
LongString = myFile.read()
print LongString
j = LongString.find('next busynothing is')
print j
print LongString[j:1000]
m = LongString[j+20:1000]
print m
n = n + m
print n
o = o + int(m)
nexturl = 'http://www.pythonchallenge.com/pc/def/linkedlist.php?busynothing=' + m
for i in range(300):
count = count + 1
myFile = urllib2.urlopen(nexturl)
headers = myFile.info()
cookie = headers.getheader("set-cookie")
c = Cookie.SimpleCookie(cookie)
print c["info"].value
p = p + c["info"].value
#print c["info"].coded_value
LongString = myFile.read()
myFile.close()
print LongString
j = LongString.find('next busynothing is')
if j == -1:
break
m = LongString[j+20:100]
n = n + m
o = o + int(m)
nexturl = 'http://www.pythonchallenge.com/pc/def/linkedlist.php?busynothing=' + m
print count
print n
print len(n)
print o
print p