zoukankan      html  css  js  c++  java
  • pythonchallenge 解谜 Level 6

    第六关地址

    http://www.pythonchallenge.com/pc/def/channel.html

    和前几关一样,首先看网页源码吧。反正不看也没办法。。。

     1 <html><!-- <-- zip --><head>
     2   <title>now there are pairs</title>
     3   <link rel="stylesheet" type="text/css" href="../style.css">
     4 </head>
     5 <body>
     6 <center>
     7 <img src="channel.jpg">
     8 <br>
     9 <!-- The following has nothing to do with the riddle itself. I just
    10 thought it would be the right point to offer you to donate to the
    11 Python Challenge project. Any amount will be greatly appreciated.
    12 
    13 -thesamet
    14 -->
    15 
    16 <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    17     <input type="hidden" name="cmd" value="_xclick">
    18     <input type="hidden" name="business" value="thesamet@gmail.com">
    19     <input type="hidden" name="item_name" value="Python Challenge donations">
    20     <input type="hidden" name="no_note" value="1">
    21     <input type="hidden" name="currency_code" value="USD">
    22     <input type="hidden" name="tax" value="0">
    23     <input type="hidden" name="bn" value="PP-DonationsBF">
    24     <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but04.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
    25     <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
    26 </form>
    27 
    28 
    29 
    30 </center></body></html>

    有用的信息 zip。<!--内容-->翻译是。     以下与谜题本身无关。。。

    所以有用的只有一个zip。一开始以为zip是一个网页,后来发现是把

    http://www.pythonchallenge.com/pc/def/channel.html

    变换成

    http://www.pythonchallenge.com/pc/def/channel.zip

    得到一个zip压缩文件。

    使用python代码解压。(压缩包解压也可以)

     1 #-*- coding:utf-8 -*-
     2 #代码版本均为python 3.5.1
     3 #Level 6
     4 
     5 import zipfile
     6 import os
     7 import glob
     8  
     9 file = zipfile.ZipFile("channel.zip", "r")
    10  
    11 print ('''列出文件''')
    12 for name in file.namelist():
    13     print(name)
    14  
    15 print ('''列出文件信息''')
    16 for info in file.infolist():
    17     print (info.filename,"文件名")
    18     print (info.date_time,"修改时间")
    19     print (info.file_size,"大小")
    20     print (info.compress_type,"压缩级别")
    21     print (info.compress_size ,"压缩数据大小")
    22     print (info.file_size,"未压缩文件大小")
    23  
    24 for i in range(1, 10):
    25     print ("")
    26  
    27 print ('''解压操作 unzip''')
    28 for name in file.namelist(): 
    29     file.extract(name,os.getcwd()+"/zipfile_module") #解压到当前目录
    30  
    31 #关闭压缩文件句柄
    32 file.close

      和之前的一关有点相似。跑了一遍代码。发现提示说答案在压缩文件注释中。

    关于python压缩文件.

    http://www.jb51.net/article/68417.htm

    最终代码

    #-*- coding:utf-8 -*-
    #代码版本均为python 3.5.1
    #Level 6
    
    import zipfile
    import os
    import glob
    import re
    
    file = zipfile.ZipFile("channel.zip", "r")
     
    
    p = 90052
    
    for name in file.namelist(): 
        line = str(file.read("%s.txt" % p))
        m = re.search('Next nothing is ([0-9]+)', line)
        print (file.getinfo("%s.txt" % p).comment.decode("utf-8"), end=" ")
        p = m.group(1)

    下一关地址。

    http://www.pythonchallenge.com/pc/def/oxygen.html
  • 相关阅读:
    CSS3——过渡
    CSS——优雅降级和渐进增强
    jq1 颜色填充器 和清空指定颜色
    1. 初识node
    javaSE- 01
    鼠标悬浮图片时弹出透明提示图层的jQuery特效
    通过jQuery制作电子时钟表的代码
    9种网页Flash焦点图和jQuery焦点图幻灯片
    7种网页图片切换方式代码
    21种网页在线客服代码实例演示
  • 原文地址:https://www.cnblogs.com/qipa/p/5512267.html
Copyright © 2011-2022 走看看