python_challenge后记

最近发现了一个挺好玩的网站(http://www.pythonchallenge.com/),利用python解决问题过关~


0

图片上一个醒目的2^38.提示说了改地址,把0改成274877906944试试呗~ok

print 2**38

1

k->m
o->q
e->g
这不就是位移为2的凯撒吗
直接解

s='''g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.'''
for i in s:
    if i.isalpha():
        i=ord(i)+2
        if i>ord('z'):
            i-=26
        i=chr(i)
    print i, 

“i hope you didnt translate it by hand. thats what computers are for. doing it in by hand is inefficient and that’s why this text is so long. using string.maketrans() is recommended. now apply on the url.”
所以把s的值改为’map’再跑一下就行啦~
网址为(http://www.pythonchallenge.com/pc/def/ocr.html)

2

这么模糊怎么recognize the characters.提示说MAYBE they are in the page source.看看源码

<!--
find rare characters in the mess below:
-->
(太长了不贴了=_=)

说的很清楚了,要找到最少的字符

s='''那一大坨字符'''
for i in range(40,127):
    if s.count(chr(i)):
        print chr(i),s.count(chr(i))

这里写图片描述

这应该得是一个单词吧~发现是equality.

3

一个小写字母,每边有三个大写字母.
看源码,又是一大坨字符.
看来就是要在这坨字符里找到符合(XXXxXXX)这种字符串,但是要注意,想要判断ABCdEFG这个是否可以,还得判断A前面和G后面是否也为大写.所以正则应该是
[^A-Z][A-Z]{3}[a-z][A-Z]{3}[^A-Z]

import re
with open('1.txt','r') as fp:
    for index,values in enumerate(re.findall("[^A-Z][A-Z]{3}[a-z][A-Z]{3}[^A-Z]",fp.read())):
        print values[4],

得出
linkedlist

4

提示linkedlist.php,打开看看
就一张图片,还可以点,点开看看
“and the next nothing is 44827”
那让nothing=44827,打开看看
“and the next nothing is 45439”
这样,那就写个脚本访问咯

import urllib
import re
s='44827'
while 1:
    url='http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing='+s
    html = urllib.urlopen(url).read()
    print html
    s= re.findall('[0-9].+',html)[0]

5

这题好坑,先放着,不想做了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值