+ 7

Import module and from module import*

What are the diffrences between import module and from module import *

11th Jun 2020, 12:52 PM
Alireza
2 RĂ©ponses
+ 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))
11th Jun 2020, 1:13 PM
HonFu
HonFu - avatar
11th Jun 2020, 2:39 PM
HonFu
HonFu - avatar