python Challenge level 3
python Challenge level 5

python Challenge level 4

TLHL28 posted @ Sat, 23 Jan 2010 07:50:42 +0800 in 随笔 with tags pythonchallenge , 1419 readers

这关给了个图片,点开图片会给出一句话

and the next nothing is ***** , ****是数字

初始数字是12345

title 是 follow the chain

试了几次后会提示,说你在手动......

其他提示在页面中,没什么特别的,找出数字,循环。一直到loop....loop.....

结果就没有出现数字的那一页。以下为解题:

 

#!/bin/env python

import urllib
import re

ourl = "http://www.pythonchallenge.com/pc/def/linkedlist.php";
code = "12345"
for i in range(400):
    params = urllib.urlencode({'nothing':code})
    #print i,
    try:
        f = urllib.urlopen(ourl+'?%s' % params)
        for line in f.readlines():
            m = re.findall('\d+',line)
            print '>> '+line
            if len(m) != 0:
                #there several number group at midway
                #chose the last one
                code = m[-1]
            else:
                break
            print '<<' + code
    except Exception, IOError:
        raise IOError

好像忘记看其他人怎么解了....

 

 


Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter