`
dexterfeng
  • 浏览: 3410 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
最近访客 更多访客>>
社区版块
存档分类
最新评论

Python Challenge Level 5

 
阅读更多

Level 5:

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

这一关比较有意思,打开page source code,提示信息为<!-- peak hell sounds familiar ? -->,打开peakhell标签,发现banner.p为一系列无意义的字符集。peakhell谐音为pickle,可知需要从序列化入手。

#!/usr/bin/python  
  
import urllib.request  
import pickle
""" 
Python Challenge, Level 5: 
    http://www.pythonchallenge.com/pc/def/peak.html
"""  

def banner(url):
    try:
        with urllib.request.urlopen(url) as resp:
            entry = pickle.load(resp)    # get a two-dimensional array for drawing the banner
            for line in entry :
                print(''.join(map(lambda x: x[0]* x[1], line)))
    except Exception as ex : 
        print(ex)
def main():  
    url = 'http://www.pythonchallenge.com/pc/def/banner.p'
    banner(url)
    
if __name__ == '__main__':  
  main()  

 在终端打印结果为:channel

替换url,进入下一关:http://www.pythonchallenge.com/pc/def/channel.html

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics