Here is a version utilising the from..import syntax.
#!/usr/bin/python
# Filename: mymodule_demo2.py
from mymodule import sayhi, version
# Alternative:
# from mymodule import *
sayhi()
print 'Version', version
The output of mymodule_demo2.py is same as the output of mymodule_demo.py.
No comments:
Post a Comment