import导入__xxx__.py文件,它的'__name__'是什么,__xxx__.py__name__,python 版本2.7
import导入__xxx__.py文件,它的'__name__'是什么,__xxx__.py__name__,python 版本2.7
python 版本2.7.2
__main__.py 文件内容如下
print '__name__ is ' + __name__
test_import.py 文件内容如下
import __main__
cmd 执行 python test_import.py
输出空空如也 求解
好吧,这是一个很小白的问题.
http://docs.python.org/2/library/main.html
This module represents the (otherwise anonymous) scope in which the interpreter’s main program executes — commands read either from standard input, from a script file, or from an interactive prompt. It is this environment in which the idiomatic “conditional script” stanza causes a script to run:
if __name__ == "__main__": main()
你看看你 import 进来的那个 __main__ 是什么 =w=
编橙之家文章,
相关内容
- Python模块相对与绝对导入两种方式的区别是什么,pyt
- Web程序中全局变量python新手不是很理解,全局变量pyt
- Python判断dict中重复值最高效方法是什么,python判断di
- Python Gevent开启猴子补丁后线程阻塞会否影响整个程序,
- 请问Nginx+uwsgi+django后端sock文件丢失解决方法是什么,
- Python实现PyQt中QTreeWidget某一行某一列值操作方法,pyq
- Pythony方法cmd打印下面这种图要怎么做?,pythonycmd,#####
- python BeautifulSoup应到遇到的解析错误,,html = """{a
- Python提取网站根域名用URL如何操作,pythonurl,我写的这段
- python 派森TypeError: printBB() takes 0 positional arguments b,ty
评论关闭