Python: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
* reloads are not transitive, so reloading module A which imports module B does not reload B. | * reloads are not transitive, so reloading module A which imports module B does not reload B. | ||
* To run a script: <code>exec(open('script.py').read())</code> | * To run a script: <code>exec(open('script.py').read())</code> | ||
== Links == | |||
* [https://learning-python.com/ Learning Python] - From the author of Learning Python and Programming Python. | |||
[[Category:Python]] | [[Category:Python]] | ||
[[Category:Programming]] | [[Category:Programming]] |
Revision as of 10:39, 2 July 2019
- Every file of Python source code that ends in
.py
is a module - no special code or naming is required. dir
fetches all names available inside a module:dir(modname)
- Each file is a self-contained namespace.
- reloads are not transitive, so reloading module A which imports module B does not reload B.
- To run a script:
exec(open('script.py').read())
Links
- Learning Python - From the author of Learning Python and Programming Python.