pythonchallenge 解谜 Level 4
2016-05-18 13:27
501 查看
下一关。。。
一张图片,于是就点击了一下。
跳转到了
显示的是:
and the next nothing is 44827
下一个。。。
and the next nothing is 45439
再来一个。。
Your hands are getting tired and the next nothing is 94485。。。
一直循环下去了。。。肯定是打开的方式不对。。
回到原网页,F12
额。回去上课,回来发代码。
这个有点坑爹。代码就直接发了。原理就是获取下一个链接的 nothing 然后用python 帮你自动进入下一个网页。大量循环。
所以可以得到第5关的链接。
目前对第5关一脸懵bi。。。
晚上解
一张图片,于是就点击了一下。
跳转到了
http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=12345
显示的是:
and the next nothing is 44827
下一个。。。
and the next nothing is 45439
再来一个。。
Your hands are getting tired and the next nothing is 94485。。。
一直循环下去了。。。肯定是打开的方式不对。。
回到原网页,F12
<!-- urllib may help. DON'T TRY ALL NOTHINGS, since it will never end. 400 times is more than enough. -->
额。回去上课,回来发代码。
这个有点坑爹。代码就直接发了。原理就是获取下一个链接的 nothing 然后用python 帮你自动进入下一个网页。大量循环。
#-*- coding:utf-8 -*- #代码版本均为python 3.5.1 #Level 4 import urllib.request import re def next_page(p): text = urllib.request.urlopen('http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=%s' % p).read().decode('utf-8') m = re.search('and the next nothing is ([0-9]+)', text) if not m: print (text) return m.group(1) p = 12345 for i in range(1,400): print (" 第%s次运行" % i,end="") p = next_page(p) print (p)
所以可以得到第5关的链接。
http://www.pythonchallenge.com/pc/def/peak.html
目前对第5关一脸懵bi。。。
晚上解
相关文章推荐
- python实现获取系统版本和mac信息上传到指定接口
- GETTING STARTED WITH PICAMERA(python picamera入门)
- python datetime时区转换
- [Python]第八讲:dict与set
- [Python]第七讲:if与while
- Python的5个基本排序算法
- ubuntu 搭建python2.x 抓取环境
- 语音情感数据库&python实现文件名的批量更改
- python实例:Django实现登录、注册
- Python TypeError: not enough arguments for format string
- python fork()创建新的进程,daemon进程
- Python实用函数
- Python Tricks(五)—— 计算 list of lists 的长度(元素个数)
- Python函数的各种参数用法(含星号参数)
- python yield的初识,Iterator与Generator
- Python Tricks(四)—— list of lists 的flatten
- 同时装了Python3和Python2,怎么用pip?
- Python正则表达式
- [XPath/Python] XPath 与 lxml (二)XPath 语法 - iFantasticMe
- python遍历删除指定后缀文件