随笔分类 -  python challenge

an interesting python programming game!
摘要:http://www.pythonchallenge.com/pc/def/linkedlist.html输入网址后会提示linkedlist.php 跳转到http://www.pythonchallenge.com/pc/def/linkedlist.php看到提示说follow the chain这一关需要抓取URL一直Follow下去点击图片进入到http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=12345提示and the next nothing is 92512 更换12345为92512后访问得到下一个数字 阅读全文
posted @ 2011-04-28 13:49 LemonLi 阅读(803) 评论(1) 推荐(0)
摘要:http://www.pythonchallenge.com/pc/def/equality.html和上一关一样 这一关需要查看源代码 在源代码的一大堆字符中找到这样的例子xXXXaXXXx 必须是3个大写字母中间的一个小写字母 正则表达式可以表示为#coding:utf-8import urllib,re# 获取HTML源代码data = urllib.urlopen\('http://www.pythonchallenge.com/pc/def/equality.html').read()# 查找[a-z]被3个[A-Z]包围的情况pat = re.compile(r&q 阅读全文
posted @ 2011-04-27 22:14 LemonLi 阅读(385) 评论(0) 推荐(0)
摘要:http://www.pythonchallenge.com/pc/def/ocr.html提示看源文件,一大堆字符,说要找到出现次数最少的字符,使用字符串的count方法可以做到,首先想到的办法是把那堆字符串保存到文本文档里面通过读取文本文档来使用count方法判断出现次数少于10次的字符>>> text = open('data.txt','r').read()>>> for a in text: l=text.count(a) if l<10: print a,':',l e : 1q : 1u : 阅读全文
posted @ 2011-04-26 16:41 LemonLi 阅读(576) 评论(1) 推荐(0)
摘要:http://www.pythonchallenge.com/pc/def/map.html图片中提示 K->M O->Q E->G 下面给了一段话 看起来是加密过了的 根据提示可以知道 每个字母后移了2位 使用string和maketrans可以解决此问题 解密出来的文字提示使用这个规律解密地址 将map解密后得到 ocr即下一关地址>>> import string >>> l = string.lowercase >>> t = string.maketrans(l, l[2:] + l[:2]) >>& 阅读全文
posted @ 2011-04-26 16:08 LemonLi 阅读(375) 评论(0) 推荐(0)
摘要:一个古老的编程游戏 很有趣,在这里把过关的历程都记录下来..顺便学习.http://www.pythonchallenge.com/pc/def/0.html第0关给了一张图片 上面的电脑画面中有一个算数题 2的38次方 提示说试着改变URL地址 把2的38次方计算出来填入URL得到下一关的地址http://www.pythonchallenge.com/pc/def/274877906944.html>>> print pow(2,38) 274877906944 阅读全文
posted @ 2011-04-26 16:06 LemonLi 阅读(209) 评论(0) 推荐(0)