lilzz
lilzz

Reputation: 5413

Python the whole Module

Normally when you execute a python file you do python *.py

but if the whole Module which contain many .py files inside

for example MyModule contain many .py file and if I do

python -m MyModule $* what would happen as oppose python individual python file?

Upvotes: 0

Views: 43

Answers (2)

aruisdante
aruisdante

Reputation: 9115

I think you may be confusing package with module. A python module is always a single .py file. A package is essentially a folder which contains a special module always named __init__.py, and one or more python modules. Attempting to execute the package will simply run the __init__.py module.

Upvotes: 2

demented hedgehog
demented hedgehog

Reputation: 7558

It runs the code in the

MyModule/__init__.py

file. Print sys.argv in that file to see what the shell is giving you in terms of command line arguments. $* is meaningless in this context unless you're in a shell script (I believe)?

Upvotes: 1

Related Questions