python C 为什么最后一个命令变量“_”不出现在dir()中?
发布时间:2023-12-17 02:02:00 所属栏目:Python 来源:DaWei
导读: 参见英文答案 >
Is the single underscore “_” a built-in variable in Python?3个
在Windows上启动Python 2.7解释器后的第一行:
>>> dir()
['__builtins__','__doc__','_
Is the single underscore “_” a built-in variable in Python?3个
在Windows上启动Python 2.7解释器后的第一行:
>>> dir()
['__builtins__','__doc__','_
参见英文答案 >
Is the single underscore “_” a built-in variable in Python?3个
输入dir()命令后,应定义特殊变量_: >>> _ ['__builtins__','__package__']但是,即使在输入_之后,当我尝试使用dir()列出交互式命名空间中的所有名称时,它也不会显示: >>> dir() ['__builtins__','__package__']如果解释器不在解释器的命名空间中,解释器如何识别它? 解决方法 _进入内置命名空间,而不是全局变量. >>> import __builtin__ >>> 3 3 >>> __builtin__._ 3dir() doesn’t list built-ins: Without arguments,return the list of names in the current local scope. 内置范围与您运行dir()的范围不同. (编辑:鲜蔬坊站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- python—networkx:各个布局的源代码
- python – ImportError:Elastic Beanstalk中没有名为djang
- 如何在多个核心上运行Keras?
- 如何使用基于numpy的日期的窗口获取时间序列的回溯移动平均
- python – 在一个表达式中打印前n个斐波那契数列
- python – 什么是django.utils.functional .__ proxy__对象
- Python – 将非常大(6.4GB)的XML文件转换为JSON
- Scipy ODR python
- python C 如何运行Tox与Travis-CI
- python – 使用BeautifulSoup在关闭body之前插入元素
推荐文章
站长推荐