Reputation: 2606
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?
Upvotes: 18
Views: 15694
Reputation: 52081
-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
Force
stdin
,stdout
andstderr
to be totally unbuffered. On systems where it matters, also putstdin
,stdout
andstderr
in binary mode.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
Upvotes: 29