问题
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,stdoutandstderrto be totally unbuffered. On systems where it matters, also putstdin,stdoutandstderrin binary mode.-m <module-name>
Search
sys.pathfor 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