Monday, September 24, 2018
Executing modules as scripts
We can execute module as a script.
Format is : python filename.py <arguments>
We can test like this and the result will show like this !!!
I test with two arguments. That's why , the results are 5 and 2.
Modules
!!!You can use these to add modules in Python!!!
import module_name Example: import math
from module_name import module’s symbol table
Example: from math import sqrt
from module_name import *
Example: form math import *
import module’s symbol table as module_name
Example: import sqrt as math
Example: from fibo import fib as fibonacci
!!! YOU CAN RESTART INTERPRETER !!!
importlib.reload(modulename)
Subscribe to:
Comments (Atom)