百度空间 | 百度首页 
 
查看文章
 
the python challenge 前4关
2009-03-03 23:55
url : http://www.pythonchallenge.com

第0关:
print 2 ** 35

第1关:
string.translate()
string.maketrans()

第2关:
正规表达式:
reobj = re.compile('[a-zA-Z]+')
reobj.findall(string)

第3关:
reobj = re.compile('[a-z]+[A-z]{3,3}[a-z][A-Z]{3,3}[a-z]+')
reobj.findall(string)

第4关:
import re
import urllib2

urlbase = 'http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing='
value = '46059'

abc = urllib2.urlopen(urlbase + value).read()

reobj = re.compile('^and the next nothing is [0-9]+$')
while reobj.match(abc):
    value = abc[24:]
    abc = urllib2.urlopen(urlbase + value).read()
print abc
print value

                                                                          ------to be continue...


类别:Python | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu