pc网站怎么做自适应,html电商网页设计代码,商城建站系统多少钱,做网站开发学什么软件Python Challenge(0-2)是个很有意思的网站#xff0c;可以磨练使用python的技巧#xff0c;每一关都有挑战#xff0c;要编写相应的代码算出关键词#xff0c;才可以获取下一关的url#xff0c;还是很好玩的QAQLEVEL 0显然是计算图片中的\(2^{38}\)#xff0c;结果为2748…Python Challenge(0-2)是个很有意思的网站可以磨练使用python的技巧每一关都有挑战要编写相应的代码算出关键词才可以获取下一关的url还是很好玩的QAQLEVEL 0显然是计算图片中的\(2^{38}\)结果为274877906944所以url为http://www.pythonchallenge.com/pc/def/274877906944.htmlprint(2**38) #输出274877906944LEVEL 1仔细观察\(K→M,O→Q,E→G\)有什么规律结论是后面的字母在字母表中都是前一个的索引加二比如#\(K\)是第11个\(M\)是第13个所以我们也可以得出转换字符串的方法import stringa g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyrq ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj. l string.ascii_lowercase ab#每次都是2所以后面多加了2个字母这是小写字母表def tran(s):tmp for i in s:if i in l:#如果当前处理的字符是字母id l.index(i)tmp l[id2]else:tmp ireturn tmpprint(tran(a))#输出了i hope you didnt translate it by hand. thats what computers are for. doing it in by hand is inefficient and thats why this text is so long. using string.maketrans() is recommended. now apply on the url. #翻译过来就是我希望你不是徒手进行这个字符转换这是计算机擅长的事情徒手做是很低效的所以我才把这个文本弄得这么长将刚才你写的处理字符串的函数用在url上试试显然调用一下就把url中的map换成了ocr得到了下一关的urlwww.pythonchallenge.com/pc/def/ocr.htmlLEVEL 2显然第三关要看清楚图片上的文字是不可能的下面提示的文字里面有page source于是马上想到查看网页源代码于是看到了如下内容然后就是一长串乱码任务很显然就是要找到下面很长一串代码中单独的元素复制这么长的代码到ide里也不方便所以可以用爬虫import requestsfrom collections import Countertext requests.get(http://www.pythonchallenge.com/pc/def/ocr.html).text#获取HTML文档final_text text.split(q Counter(final_text)#对里面的所有字符计数t [i for i in q if q[i]1]#找出只出现一次的字符print(.join(t))#输出了equality根据输出的内容很显然下一个网页的url为http://www.pythonchallenge.com/pc/def/equality.htmlLEVEL 3有了上一道题的经验看了下图片和文字说明题目的意思应该是查找类似\(AAAbCCC\)这种格式的字符串我果断查看了一下页面源代码果然有一大堆文本在等着我去处理...想起了正则表达式处理起来轻松多了import requestsimport retext requests.get(http://www.pythonchallenge.com/pc/def/equality.html).textfinal_text re.findall(, text, re.DOTALL)[-1]#re.DOTALL表示忽略换行符ans .join(re.findall([^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z],final_text))print(ans)#输出了linkedlistLEVEL 4点击图片之后发现url变成了http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing12345提示说下一个nothing的值抱着试试看的态度接连输入了几个发现这个linkedlist很长很长所以写了如下代码import requestsimport repreurl http://www.pythonchallenge.com/pc/def/linkedlist.php?nothingid 12345while True:url preurl str(id)text requests.get(url).textid text.split( )[-1]print(text)#运行了一会之后终于出了结果peak.html下一关的url为http://www.pythonchallenge.com/pc/def/peak.htmlLEVEL 5略坑peakhell念快点就是pickle了pickle是python的一个库所以编写代码如下import picklefrom urllib.request import urlopenimport requeststext pickle.load(urlopen(http://www.pythonchallenge.com/pc/def/banner.p))for line in text:print(.join([k*v for k,v in line]))输出结果为channel所以下一关的url为http://www.pythonchallenge.com/pc/def/channel.htmlLEVEL 6习惯性地打开页面源代码看到zip下载http://www.pythonchallenge.com/pc/def/channel.zip后打开readme.txt文档看到welcome to my zipped list.hint1: start from 90052hint2: answer is inside the zip所以应该是要从90052.txt开始像之前的linkedlist一个个找下去最后的输出是Collect the comments.翻zipfile的文档看到zipfile.comments写了下代码import zipfile, refile zipfile.ZipFile(channel.zip)num 90052comments []while True:content file.read(num .txt).decode(utf-8)comments.append(file.getinfo(num .txt).comment.decode(utf-8))print(content)match re.search(Next nothing is (\d),content)if match None:breaknum match.group(1)print(.join(comments))its in the air. look at the letters.