i*****f 发帖数: 578 | 1 import this
>>> dir(this)
['__builtins__', '__doc__', '__file__', '__name__', '__package__', 'c', 'd',
'i', 's']
>>> this.c
'!'
>>> this.d
{'A': 'N', 'C': 'P', 'B': 'O', 'E': 'R', 'D': 'Q', 'G': 'T', 'F': 'S', 'I':
'V',
'H': 'U', 'K': 'X', 'J': 'W', 'M': 'Z', 'L': 'Y', 'O': 'B', 'N': 'A', 'Q':
'D',
'P': 'C', 'S': 'F', 'R': 'E', 'U': 'H', 'T': 'G', 'W': 'J', 'V': 'I', 'Y':
'L',
'X': 'K', 'Z': 'M', 'a': 'n', 'c': 'p', 'b': 'o', 'e': 'r', 'd': 'q', 'g':
't',
'f': 's', 'i': 'v', 'h': 'u', 'k': 'x', | i*****f 发帖数: 578 | 2 seems we need to use the char. map in this.d to decrypt this.s ???
then what the hell is this.i and this.c???
',
【在 i*****f 的大作中提到】 : import this : >>> dir(this) : ['__builtins__', '__doc__', '__file__', '__name__', '__package__', 'c', 'd', : 'i', 's'] : >>> this.c : '!' : >>> this.d : {'A': 'N', 'C': 'P', 'B': 'O', 'E': 'R', 'D': 'Q', 'G': 'T', 'F': 'S', 'I': : 'V', : 'H': 'U', 'K': 'X', 'J': 'W', 'M': 'Z', 'L': 'Y', 'O': 'B', 'N': 'A', 'Q':
| i*****f 发帖数: 578 | 3 ok i seems to figured it out. it seem just the way how the message "the zen
of python" is calculated:
import this, string
# after the msg has been already printed...however...
tab = string.maketrans(
''.join(this.d.keys()),
''.join([this.d[c] for c in this.d.keys()]) )
msg = this.s.translate(tab)
print msg
# you'll see the msg again...
but what's this.c and this.i ????
【在 i*****f 的大作中提到】 : seems we need to use the char. map in this.d to decrypt this.s ??? : then what the hell is this.i and this.c??? : : ',
| j*a 发帖数: 14423 | 4 check the source code
zen
【在 i*****f 的大作中提到】 : ok i seems to figured it out. it seem just the way how the message "the zen : of python" is calculated: : import this, string : # after the msg has been already printed...however... : tab = string.maketrans( : ''.join(this.d.keys()), : ''.join([this.d[c] for c in this.d.keys()]) ) : msg = this.s.translate(tab) : print msg : # you'll see the msg again...
| i*****f 发帖数: 578 | 5 kao, that's cheating :)
【在 j*a 的大作中提到】 : check the source code : : zen
| i*****f 发帖数: 578 | 6 原来c和i是这样来的……
哈哈
【在 j*a 的大作中提到】 : check the source code : : zen
| i*****f 发帖数: 578 | 7 真是太geek了
【在 i*****f 的大作中提到】 : 原来c和i是这样来的…… : 哈哈
|
|