I was wondering the purpose of runpy
module in Python and how does it help in day to day development of the Python user community?
Can someone please explain the necessity, usage and advantages of runpy
module in python?
The docs say:
The runpy module is used to locate and run Python modules without importing them first. Its main use is to implement the -m command line switch that allows scripts to be located using the Python module namespace rather than the filesystem.
You can run a python module like this:
python -m SimpleHTTPServer 8000
The runpy
module enables this functionality. It may not be useful outside of this context.