What is the difference when calling python methods from names and from class.
Take for example the time API.
import time
time.strptime("some params")
However,
When i tried to create a python file (xyz.py)
xyz.py
def test():
print 1
And i tried the following:
import abc
abc.test() --- > module has no attribute test
How do i achieve what the time API did
EDIT:
Saved the filename as xyz instead of abc and the error was resolved.
When python searches for a module to import, it first uses sys.modules
or the built-in modules:
When a module named spam is imported, the interpreter first searches for a built-in module with that name. If not found ...
Since there is already an abc
module you're importing the wrong module.
Change the name of your module.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments