Answer the question
In order to leave comments, you need to log in
How to properly import a module in python?
just started learning python and according to Lutz's book I'm trying to import
the threenames.py module
a = 'parrot'
b = 'carrot'
c = 'same thing'
print (a,b,c)
>>> import threenames.py
parrot carrot same thing
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2218, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'threenames.py'; 'threenames' is not a package
>>>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question