Hacking/Python_challenge

[Python Challenge] 2

MitNy 2016. 11. 14. 15:02



recognize the characters. maybe they are in the book, 

but MAYBE they are in the page source.



힌트를 보니 페이지 소스를 분석해야 하는 것 같다.


페이지 소스를 보니 find rare characters in the mess below: 가 있고

그 아래 엄청 많은 특수문자들이 있었다. 페이지 소스도 글에 같이 넣으려 했으나 포스팅이 불가능할만큼 느려져서 삭제해버렸다.ㅠ

훑어보니 알파벳이 있는 것 같고 알파벳을 찾아내어 출력하면 답이 나올 것 같다.




import urllib

import string


web = urllib.urlopen("http://www.pythonchallenge.com/pc/def/ocr.html")

res = web.read()

answer =''


for i in range(res.find('%%$@_$^__'),len(res)):

        if res[i].isalpha():

                answer = answer+res[i]


print answer



페이지의 url을 불러와서 찾을 범위의 주석이 시작되는  %%$@_$^__ 부분부터 끝까지

알파벳이 있다면 answer에 더해서 answer를 출력한다


<실행결과>



페이지 url에서 orc를 equality로 바꿔주면 다음 문제로 넘어가게 된다.