夢追い人

"It takes a dreamer to make a dream come true."―Vincent Willem van Gogh

PythonChallenge#1

久しぶりにpythonchallengeやりました。。。

level1の回答です。


とりあえずのソースコード
#! /usr/bin/python

import string


def rewrite():
src = "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."
text = src.translate(string.maketrans('abcdefghijklmnopqrstuvwxyz',
                        'cdefghijklmnopqrstuvwxyzab'))
print text

"""
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.
""" 
解説です。
メインはsrc.translate(string.maketrans('abcdefghijklmnopqrstuvwxyz',
'cdefghijklmnopqrstuvwxyzab'))です。
これはpythonのstringモジュールにある置換関数で、次のように使います。
src.translate(string.maketrans(patern1,patern2))
パターンには上のような文字の羅列をいれます。
maketrans関数はpatern1に対応するpatern2の文字に文字列を置き換えてくれます。

…で、レベル2に行く方法なのですが、これは文章を解読しても分かりにくいと思うのでここでヒントを言っておくとこの長い文章と同じようにUrlを改変すればいけます。
そして出てくるのが本の画像と『recognize the characters. maybe they are in the book, but MAYBE in the page source.』
ここまでくると本当の謎解きになってしまいそうw
頑張ってみます。