+ 7
Import module and from module import*
What are the diffrences between import module and from module import *
5 Antworten
+ 7
import random (as an example) creates *one* name in your globals: random.
Now you have to write random in front of everything you use from random.
print(random.randint(1, 10))
from random import *
... on the other hand imports the names from the module.
Then you can directly write:
print(randint(1, 10))
+ 5
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥, being mod has no relation to knowing more about Python. ;-)