当我在Windows 10上运行ipython
并执行dir
函数时,得到的结果是:
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:57:15) [MSC v.1915 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: dir()
Out[1]:
['In',
'Out',
'_',
'__',
'___',
'__builtin__',
'__builtins__',
'__doc__',
'__loader__',
'__name__',
'__package__',
'__spec__',
'_dh',
'_i',
'_i1',
'_ih',
'_ii',
'_iii',
'_oh',
'exit',
'get_ipython',
'quit']
In [2]:
上面有一个_
、__
和___
,这些变量作为内置变量的含义是什么?在
也没有得到_i
,_iii
的意思,似乎这个东西只在IPython
中定义。在
_oh
显示一个dict,它存储ipython上的所有输出。在
_u用于:1。翻译,2。名字后面,3。在名称之前 f、 e.对于忽略值:
根据IPythondocs,
_*
值缓存最近输出的值:相反,
_i*
变量store recent inputs:相关问题 更多 >
编程相关推荐