Following the idea yesterday, here is my first script:
import string;
import re;
def followNothing(url):
page=urllib.urlopen(url)
pagecontent = page.read()
print pagecontent
result =re.search(”[0-9]{5}”, pagecontent)
if result:
num = pagecontent[result.start():result.end()]
nexturl = “http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=” + num
followNothing(nexturl)
else:
print “fix the script!”
and I got:
and the next nothing is 92512
and the next nothing is 64505
<font color=red>Your hands are getting tired </font>and the next nothing is 50010
and the next nothing is 29193
and the next nothing is 89924
and the next nothing is 65471
and the next nothing is 69977
and the next nothing is 6306
fix the script!
OK, it’s not necessary to be 5 numbers.
import string;
import re;
def followNothing(url):
page=urllib.urlopen(url)
pagecontent = page.read()
print pagecontent
result =re.search(”[0-9]+”, pagecontent)
if result:
num = pagecontent[result.start():result.end()]
nexturl = “http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=” + num
followNothing(nexturl)
else:
print “fix the script!”
and…
and the next nothing is 37852
and the next nothing is 61066
There maybe misleading numbers in the
text. One example is 61067. Look only for the next nothing and the next nothing is 53522
You’ve been misleaded to here. Go to previous
one and check.
fix the script!
OK,
import string;
import re;
def followNothing(url):
page=urllib.urlopen(url)
pagecontent = page.read()
print pagecontent
result =re.search(”next nothing is [0-9]+”, pagecontent)
if result:
num = pagecontent[result.start()+16:result.end()]
nexturl = “http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=” + num
followNothing(nexturl)
else:
print “fix the script!”
And after a long time…
Yes. Divide by two and keep going.
fix the script!
I visited http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=46059 and found it’s still “and the next nothing is 33110″
Don’t know what the pattern is so just do it manually this time: call followNothing(”http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=33110″)
and the next nothing is 65667
peak.html
fix the script!
OK, challenge 5 is at http://www.pythonchallenge.com/pc/def/peak.html
The hint is “pronounce it”, the title is “peak hell”. Vies the page source and there is another hint: “peak hell sounds familiar ? ”
Well I’m not a native speaker so I first look throu the module names. And I found pickle
visit http://www.pythonchallenge.com/pc/def/pickle.html and it told me “yes! pickle!”. No title, no more hints, no more source. What’s going on?
So I took a look at the source of http://www.pythonchallenge.com/pc/def/peak.html again and found a wired line:
Give http://www.pythonchallenge.com/pc/def/banner.p a vist and got a mess. I think I’ll need to unpickling this mess tomorrow.
Tags: python_challenge, python, python-challenge
Comments 1
thks for the tip banner.p (i missed it)
Posted 10 Oct 2011 at 6:24 pm ¶Post a Comment
You could use <code type="name"> to get your code colorized