• pythonchallenge 解谜 Level 4


    下一关。。。

    一张图片,于是就点击了一下。

    跳转到了

    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。。。

    晚上解

  • 相关阅读:
    vue(七)--监听属性(watch)
    vue(六)--计算属性(computed)
    JVM参数配置&&命令工具
    GC回收算法&&GC回收器
    JVM宏观认知&&内存结构
    分布式配置中心Apollo——QuickStart
    了解敏捷开发
    服务链路跟踪 && 服务监控
    数据读写API——IO流
    Nginx+Zuul集群实现高可用网关
  • 原文地址:https://www.cnblogs.com/qipa/p/5504910.html
Copyright © 2020-2023  润新知