本文共 659 字,大约阅读时间需要 2 分钟。
from python -h, -m mod : run library module as a script (terminates option list).
Python modules are just script files that are located in a place where Python can find them.
As with all scripts, you can just run them directly if you know where they are, e.g. python /path/to/module.py
__name__ in PythonAs we learn from ,a .py file can be executed in two ways:
If you want run a module as main program, you should know the full path to the module ,like python /path/module.py, also can use the python -m module just get the same result.
直接执行的是module.py脚本,通过-m参数是执行module实现执行module.py的效果。
转载地址:http://wuge.baihongyu.com/