PythonChallenge 挑战之路 Level-3
来源:互联网 发布:西安软件学校排名 编辑:程序博客网 时间:2024/05/21 08:17
第三关的谜面是:
One small letter, surrounded by EXACTLY three big bodyguards on each of its sides.
大概意思就是每一个小写字母的两边都有且只有3个大写字母,也就是如oXXXaXXXo的形式中,a就是需要找出的小写字母。
同样从网页源码里找到目标文本,代码如下:
import urllibimport retext = urllib.urlopen('http://www.pythonchallenge.com/pc/def/equality.html').read().split('<!--')[-1].replace('-->', '')print "".join(re.findall('[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]', text))结果为:
linkedlist
替换URL后提示使用linkedlist.php,顺利进入下一关:)
=================分割线===================
这个方法挺有意思:
>>> import string>>> code = """... <copy and paste>... """.replace("\n", "")>>> word = "">>> for i in range(len(code) - 8):... if [c for c in code[i:i+9] if c in string.lowercase] == [code[i], code[i+4], code[i+8]]:... word += code[i+4]...>>> word'linkedlist'
- PythonChallenge 挑战之路 Level-3
- Python挑战游戏( PythonChallenge)闯关之路Level- 3
- PythonChallenge 挑战之路 Level-0
- PythonChallenge 挑战之路 Level-1
- PythonChallenge 挑战之路 Level-2
- PythonChallenge 挑战之路 Level-4
- PythonChallenge 挑战之路 Level-5
- PythonChallenge 挑战之路 Level-6
- PythonChallenge 挑战之路 Level-7
- PythonChallenge 挑战之路 Level-8
- PythonChallenge 挑战之路 Level-9
- PythonChallenge 挑战之路 Level-10
- PythonChallenge 挑战之路 Level-11
- PythonChallenge 挑战之路 Level-12
- PythonChallenge 挑战之路 Level-13
- PythonChallenge 挑战之路 Level-14
- PythonChallenge 挑战之路 Level-15
- PythonChallenge 挑战之路 Level-16
- C++开发者都应该使用的10个C++11特性
- iOS6:在你的App内使用Passbook
- 动态时间显示自动跳转
- 从今天开始写博客了
- MySQL server has gone away 问题的解决方法
- PythonChallenge 挑战之路 Level-3
- reportlab使用示例:文字和图片
- 【Java设计模式】之原型模式
- hdu 1171
- 查看汇编代码
- 设计模式学习笔记之AbstractFactory模式
- ORM查询语言(OQL)简介
- Junit使用教程(四)
- ORA-00054 锁表问题