Je suis novice en python et j'apprends maintenant à importer un module ou une fonction, mais j'ai eu ces erreurs. Le code python est enregistré sous le nom: hello_module.py
erreur lors de l'utilisation de la commande d'importation en python
code python:
def hello_func():
print ("Hello, World!")
hello_func()
import hello_module
hello_module.hello_func()
message d'erreur:
Traceback (most recent call last):
File "C:/Python33/hello_module.py", line 9, in <module>
import hello_module
File "C:/Python33\hello_module.py", line 10, in <module>
hello_module.hello_func()
AttributeError: 'module' object has no attribute 'hello_func'
import hello_module ne doit pas être dans hello_module.py. cela n'a pas de sens. – njzk2