由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
_Python版 - damn! just found some more "secrets" INSIDE "this"
相关主题
An easter egg in Python :)solve equations of integrals in python (转载)
如何用 Python 修改 mp3 文件的音乐标题ploting 3D surface in python (转载)
solve integral eq. embeeded with another integral eq. (转载)error draw map from shape file Python 3.2 basemap (转载)
One question about import exe result to python scriptsetter and getter
google app engine 里 加载 numpyOther languages have "variables", Python has "names"
如何在程序里测量一段代码执行的时间如何传递secret key
在用 matplotlib 画多条曲线时,如何选择在一个colormap中最“等距”的颜色https certificate??
请问如何import一个python文件Python macro question
相关话题的讨论汇总
话题: __话题: builtins话题: import话题: dir话题: doc
1 (共1页)
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是这样来的……
: 哈哈

1 (共1页)
相关主题
Python macro questiongoogle app engine 里 加载 numpy
Password does not decrypt secret key如何在程序里测量一段代码执行的时间
西方国家为什么不联名抵制日本人吃海豚?在用 matplotlib 画多条曲线时,如何选择在一个colormap中最“等距”的颜色
要想知道白皮有多渣,听广播就知道请问如何import一个python文件
An easter egg in Python :)solve equations of integrals in python (转载)
如何用 Python 修改 mp3 文件的音乐标题ploting 3D surface in python (转载)
solve integral eq. embeeded with another integral eq. (转载)error draw map from shape file Python 3.2 basemap (转载)
One question about import exe result to python scriptsetter and getter
相关话题的讨论汇总
话题: __话题: builtins话题: import话题: dir话题: doc