What do -u, -m parameters do?

不羁的心 提交于 2020-01-07 06:54:11

问题


What do parameters -u, -m mean and what do they do?

for example:

python -u my_script.py 

or

python -m my_script.py

Where can I read about them?


回答1:


-u is used to force stdin, stdout and stderr to be totally unbuffered, which otherwise is line buffered on the terminal

-m searches sys.path for the named module and runs the corresponding .py file as a script. An example would be timeit module. The command python -m timeit "python script" would return the time taken for the script to execute.

Quoting from the docs

-u

Force stdin, stdout and stderr to be totally unbuffered. On systems where it matters, also put stdin, stdout and stderr in binary mode.

-m <module-name>

Search sys.path for the named module and execute its contents as the __main__ module.

You can read more about them and other options here



来源:https://stackoverflow.com/questions/32285782/what-do-u-m-parameters-do

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!