+ 1

I have a problem with python when I create a module and I call it my interpreter display "no module named "

This is my code : # -*- coding : Latin-1 -* """module multipli contenant la fonction table""" def table(nb, max=10): """Fonction affichant la table de multiplication par nb de * nb jusqu'à max * nb""" i = 0 while i < max: print(i + 1, "*", nb, "=", (i + 1) * nb) i += 1 I save it as multpli.py and when I call it like a module 👇👇 : from multipli import * table(9) I get error " no module named multipli"

27th Feb 2020, 5:27 PM
Dr Kirv
Dr Kirv - avatar
4 Réponses
+ 1
Dr Kirv That's easy to solve, just make sure that your new file that's importing multipli.py is saved in the same folder as multipli.py, it won't work UNTIL you save that new file in the same folder :)
27th Feb 2020, 8:51 PM
LDSD
LDSD - avatar
+ 1
What operating system are you using, and if any, what program are you using? or are you using shell? On Windows, if you are using IDLE, you must add the directory where you saved your multipli.py to your PYTHONPATH. If you are using the terminal or command prompt, you must first move to the directory where the *.py is located, and you can run the python command and import it inside the shell.
27th Feb 2020, 7:09 PM
LDSD
LDSD - avatar
+ 1
LSDS I use pydroid 3 on my android
27th Feb 2020, 8:32 PM
Dr Kirv
Dr Kirv - avatar
+ 1
LDSD It worked thank's a lot🙏🙏
27th Feb 2020, 8:54 PM
Dr Kirv
Dr Kirv - avatar