思路:
把这个地址打开:http://www.pythonchallenge.com/pc/def/ocr.html 如上图:我们发现如下有一句这样的: reconize the characters maybe they are in the book,but MABE they are in the page source.关键字MABE they are in the page source。哈哈思路来了。把源码下载下来 发现一大串乱码字符 大约有两千多行。。下载下来后,复制到编译器里用读取出来,看看里面到底是啥???如下图:
没的说啊读出来看看。如下:
# -*- coding:utf-8 -*-
# **********************************
# ** http://weibo.com/lixiaodaoaaa #
# ** create at 2017/6/13 00:04 ***
# ****** by:lixiaodaoaaa ***********
myText = file("ocr.txt").read()
myUrl = "http://www.pythonchallenge.com/pc/def/ocr.html"
newAddressEnhanceAlpha = "".join([char for char in myText if char.isalnum()])
print myUrl.replace("ocr",newAddressEnhanceAlpha)
# for char in myText:
# if char.isalnum():
# print char,
# for char in set(myText):
# if char.isalnum():
# myStrs.append(char)
# index = myText.index(char)
# indexs.append(index)
# indexs.sort()
# myMap[index] = char
#
# for i in range(len(myMap)):
# print myMap[indexs[i]],
打印出来的结果如下:
http://www.pythonchallenge.com/pc/def/equality.html 完美闯关。注释的部分比较烂的代码 。要不断的循环,从中得到数据,循环遍历 穷举 貌似不是一个很好的解决方案。完美需要用更好的处理方案,就是如前几行所示。 简单明了的处理一下即可!GOOD。