第0关:http://www.pythonchallenge.com/pc/def/0.html
线索:试着改变URL的地址-->把图片中得到的数字输入到URL中
2**38
输出:
274877906944
第1关:http://www.pythonchallenge.com/pc/def/274877906944.html
线索:想要解开它,你需要想2次--> K-M,O-Q,E-G 每个字母都往后推了2次
def transmes(mes): intab = 'abcdefghijklmnopqrstuvwxyz' outtab ='cdefghijklmnopqrstuvwxyzab' trantab = str.maketrans(intab,outtab) message = mes.translate(trantab) print(message) message = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj." transmes(message) url = 'map' transmes(url)
输出:
i hope you didnt translate it by hand. thats what computers are for. doing it in by hand is inefficient and that's why this text is so long. using string.maketrans() is recommended. now apply on the url.
希望你没有一个一个去推算字母解密这段话,这样的工作应该是由电脑来做。手动推送很费时,所以这段话会如此之长。推荐用 string.maketrans() 方法来解密这道题,现在把它应用在url上。
ocr
第2关:http://www.pythonchallenge.com/pc/def/ocr.html
线索:找出字母。他们可能在书中,可能在页面源码上。-->查看源代码,看注释,在下面这堆乱七八糟的信息中,找到出现次数最少的字母
page_source = '''%%$@_$^__#....... ''' #内容太长,已省略 def count_char(mes): infos = {} for i in mes: if i.isalpha(): if i not in infos: infos[i] = 0 infos[i] += 1 a = sorted(infos.items(),key = lambda item:item[1])[0:10] print(a) count_char(page_source)
输出:
[('e', 1), ('q', 1), ('u', 1), ('a', 1), ('l', 1), ('i', 1), ('t', 1), ('y', 1)]
第3关:http://www.pythonchallenge.com/pc/def/equality.html
线索:一个小写字母的两边准确地被3个大写字母包围 --> 那么它的格式就是 xXXXxXXXx
mes = '''kAewtloY.......piqBd ''' #由于内容很长,已省略 import re pattern = r'[a-z][A-Z]{3}[a-z][A-Z]{3}[a-z]' for i in re.findall(pattern,mes): print(i[4],end='')
输出:
linkedlist
第4关:http://www.pythonchallenge.com/pc/def/linkedlist.php
线索:打开源代码,注释中 --> urllib 可能有帮助。千万不要把所有的 NOTHING 都试一遍,因为它不会停,400 次完全够了
import requests import re from bs4 import BeautifulSoup url = 'http://www.pythonchallenge.com/pc/def/linkedlist.php' data = requests.get(url) soup = BeautifulSoup(data.text,'lxml') href = soup.a['href'] p = re.search(r'(\d)+$',href).group() i = 0 while(True): next_url = url + '?nothing=' + str(p) next_page = requests.get(next_url).text print(str(i)+":"+ next_page,p) if re.search(r'two',next_page): p =int(p)/2 elif (re.search(r'(\d)+$',next_page)): p = re.search(r'(\d)+$',next_page).group() else: break i += 1
输出:
0:and the next nothing is 44827 12345 1:and the next nothing is 45439 44827 2:<font color=red>Your hands are getting tired </font>and the next nothing is 94485 45439 3:and the next nothing is 72198 94485 4:and the next nothing is 80992 72198 5:and the next nothing is 8880 80992 6:and the next nothing is 40961 8880 7:and the next nothing is 58765 40961 8:and the next nothing is 46561 58765 9:and the next nothing is 13418 46561 10:and the next nothing is 41954 13418 11:and the next nothing is 46782 41954 12:and the next nothing is 92730 46782 13:and the next nothing is 89229 92730 14:and the next nothing is 25646 89229 15:and the next nothing is 74288 25646 16:and the next nothing is 25945 74288 17:and the next nothing is 39876 25945 18:and the next nothing is 8498 39876 19:and the next nothing is 34684 8498 20:and the next nothing is 62316 34684 21:and the next nothing is 71331 62316 22:and the next nothing is 59717 71331 23:and the next nothing is 76893 59717 24:and the next nothing is 44091 76893 25:and the next nothing is 73241 44091 26:and the next nothing is 19242 73241 27:and the next nothing is 17476 19242 28:and the next nothing is 39566 17476 29:and the next nothing is 81293 39566 30:and the next nothing is 25857 81293 31:and the next nothing is 74343 25857 32:and the next nothing is 39410 74343 33:and the next nothing is 5505 39410 34:and the next nothing is 27104 5505 35:and the next nothing is 54003 27104 36:and the next nothing is 23501 54003 37:and the next nothing is 21110 23501 38:and the next nothing is 88399 21110 39:and the next nothing is 49740 88399 40:and the next nothing is 31552 49740 41:and the next nothing is 39998 31552 42:and the next nothing is 19755 39998 43:and the next nothing is 64624 19755 44:and the next nothing is 37817 64624 45:and the next nothing is 43427 37817 46:and the next nothing is 15115 43427 47:and the next nothing is 44327 15115 48:and the next nothing is 7715 44327 49:and the next nothing is 15248 7715 50:and the next nothing is 61895 15248 51:and the next nothing is 54759 61895 52:and the next nothing is 54270 54759 53:and the next nothing is 51332 54270 54:and the next nothing is 63481 51332 55:and the next nothing is 12362 63481 56:and the next nothing is 94476 12362 57:and the next nothing is 87810 94476 58:and the next nothing is 6027 87810 59:and the next nothing is 47551 6027 60:and the next nothing is 79498 47551 61:and the next nothing is 81226 79498 62:and the next nothing is 4256 81226 63:and the next nothing is 62734 4256 64:and the next nothing is 25666 62734 65:and the next nothing is 14781 25666 66:and the next nothing is 21412 14781 67:and the next nothing is 55205 21412 68:and the next nothing is 65516 55205 69:and the next nothing is 53535 65516 70:and the next nothing is 4437 53535 71:and the next nothing is 43442 4437 72:and the next nothing is 91308 43442 73:and the next nothing is 1312 91308 74:and the next nothing is 36268 1312 75:and the next nothing is 34289 36268 76:and the next nothing is 46384 34289 77:and the next nothing is 18097 46384 78:and the next nothing is 9401 18097 79:and the next nothing is 54249 9401 80:and the next nothing is 29247 54249 81:and the next nothing is 13115 29247 82:and the next nothing is 23053 13115 83:and the next nothing is 3875 23053 84:and the next nothing is 16044 3875 85:Yes. Divide by two and keep going. 16044 86:and the next nothing is 25357 8022.0 87:and the next nothing is 89879 25357 88:and the next nothing is 80119 89879 89:and the next nothing is 50290 80119 90:and the next nothing is 9297 50290 91:and the next nothing is 30571 9297 92:and the next nothing is 7414 30571 93:and the next nothing is 30978 7414 94:and the next nothing is 16408 30978 95:and the next nothing is 80109 16408 96:and the next nothing is 55736 80109 97:and the next nothing is 15357 55736 98:and the next nothing is 80887 15357 99:and the next nothing is 35014 80887 100:and the next nothing is 16523 35014 101:and the next nothing is 50286 16523 102:and the next nothing is 34813 50286 103:and the next nothing is 77562 34813 104:and the next nothing is 54746 77562 105:and the next nothing is 22680 54746 106:and the next nothing is 19705 22680 107:and the next nothing is 77000 19705 108:and the next nothing is 27634 77000 109:and the next nothing is 21008 27634 110:and the next nothing is 64994 21008 111:and the next nothing is 66109 64994 112:and the next nothing is 37855 66109 113:and the next nothing is 36383 37855 114:and the next nothing is 68548 36383 115:and the next nothing is 96070 68548 116:and the next nothing is 83051 96070 117:and the next nothing is 58026 83051 118:and the next nothing is 44726 58026 119:and the next nothing is 35748 44726 120:and the next nothing is 61287 35748 121:and the next nothing is 559 61287 122:and the next nothing is 81318 559 123:and the next nothing is 50443 81318 124:and the next nothing is 1570 50443 125:and the next nothing is 75244 1570 126:and the next nothing is 56265 75244 127:and the next nothing is 17694 56265 128:and the next nothing is 48033 17694 129:and the next nothing is 56523 48033 130:and the next nothing is 51253 56523 131:and the next nothing is 85750 51253 132:and the next nothing is 42760 85750 133:and the next nothing is 11877 42760 134:and the next nothing is 15962 11877 135:and the next nothing is 75494 15962 136:and the next nothing is 87283 75494 137:and the next nothing is 40396 87283 138:and the next nothing is 49574 40396 139:and the next nothing is 82682 49574 140:There maybe misleading numbers in the text. One example is 82683. Look only for the next nothing and the next nothing is 63579 82682 141:and the next nothing is 37278 63579 142:and the next nothing is 53548 37278 143:and the next nothing is 66081 53548 144:and the next nothing is 67753 66081 145:and the next nothing is 56337 67753 146:and the next nothing is 3356 56337 147:and the next nothing is 94525 3356 148:and the next nothing is 89574 94525 149:and the next nothing is 4413 89574 150:and the next nothing is 82294 4413 151:and the next nothing is 56060 82294 152:and the next nothing is 95493 56060 153:and the next nothing is 80865 95493 154:and the next nothing is 66242 80865 155:and the next nothing is 16065 66242 156:and the next nothing is 62145 16065 157:and the next nothing is 23147 62145 158:and the next nothing is 83763 23147 159:and the next nothing is 62381 83763 160:and the next nothing is 76841 62381 161:and the next nothing is 91706 76841 162:and the next nothing is 9268 91706 163:and the next nothing is 64814 9268 164:and the next nothing is 80809 64814 165:and the next nothing is 14039 80809 166:and the next nothing is 73355 14039 167:and the next nothing is 81905 73355 168:and the next nothing is 36402 81905 169:and the next nothing is 27221 36402 170:and the next nothing is 79607 27221 171:and the next nothing is 91763 79607 172:and the next nothing is 11631 91763 173:and the next nothing is 76396 11631 174:and the next nothing is 69905 76396 175:and the next nothing is 11073 69905 176:and the next nothing is 71281 11073 177:and the next nothing is 54345 71281 178:and the next nothing is 19047 54345 179:and the next nothing is 34376 19047 180:and the next nothing is 3193 34376 181:and the next nothing is 74258 3193 182:and the next nothing is 62712 74258 183:and the next nothing is 1823 62712 184:and the next nothing is 21232 1823 185:and the next nothing is 87890 21232 186:and the next nothing is 21545 87890 187:and the next nothing is 37136 21545 188:and the next nothing is 23060 37136 189:and the next nothing is 5385 23060 190:and the next nothing is 4620 5385 191:and the next nothing is 39111 4620 192:and the next nothing is 35914 39111 193:and the next nothing is 60310 35914 194:and the next nothing is 19178 60310 195:and the next nothing is 44671 19178 196:and the next nothing is 45736 44671 197:and the next nothing is 9216 45736 198:and the next nothing is 12585 9216 199:and the next nothing is 11302 12585 200:and the next nothing is 33096 11302 201:and the next nothing is 13967 33096 202:and the next nothing is 57004 13967 203:and the next nothing is 64196 57004 204:and the next nothing is 73929 64196 205:and the next nothing is 24800 73929 206:and the next nothing is 25081 24800 207:and the next nothing is 90033 25081 208:and the next nothing is 45919 90033 209:and the next nothing is 54827 45919 210:and the next nothing is 73950 54827 211:and the next nothing is 56978 73950 212:and the next nothing is 8133 56978 213:and the next nothing is 61900 8133 214:and the next nothing is 47769 61900 215:and the next nothing is 631 47769 216:and the next nothing is 2284 631 217:and the next nothing is 60074 2284 218:and the next nothing is 35959 60074 219:and the next nothing is 57158 35959 220:and the next nothing is 90990 57158 221:and the next nothing is 27935 90990 222:and the next nothing is 99927 27935 223:and the next nothing is 41785 99927 224:and the next nothing is 32660 41785 225:and the next nothing is 4328 32660 226:and the next nothing is 42067 4328 227:and the next nothing is 8743 42067 228:and the next nothing is 38613 8743 229:and the next nothing is 21100 38613 230:and the next nothing is 77864 21100 231:and the next nothing is 6523 77864 232:and the next nothing is 6927 6523 233:and the next nothing is 82930 6927 234:and the next nothing is 35846 82930 235:and the next nothing is 31785 35846 236:and the next nothing is 41846 31785 237:and the next nothing is 72387 41846 238:and the next nothing is 59334 72387 239:and the next nothing is 65520 59334 240:and the next nothing is 93781 65520 241:and the next nothing is 55840 93781 242:and the next nothing is 80842 55840 243:and the next nothing is 59022 80842 244:and the next nothing is 23298 59022 245:and the next nothing is 27709 23298 246:and the next nothing is 96791 27709 247:and the next nothing is 75635 96791 248:and the next nothing is 52899 75635 249:and the next nothing is 66831 52899 250:peak.html 66831