0

Questions Import in py

What's Different between: 1- from os import * (from any library import *) 2 import os ( import any library) ما الفرق بين: 1- from os import * (from اي مكتبة آخرى import *) 2 import os ( import اي مكتبة آخرى)

3rd Oct 2021, 5:35 PM
Sarmad Saad
Sarmad Saad - avatar
2 Respostas
+ 3
the first imports all of the functions, classes and methods into the namespace of the py file. Meaning no need to prefix the call to a function with "<library_name>." you can just call the functions as they are in the namespace. The latter uses the forementioned format. Importing everything from a library into a namespace ia usually frowned upon because it makes things more confusing and it may conflict with another name.
3rd Oct 2021, 7:00 PM
Slick
Slick - avatar
+ 1
Thanks 😊. Slick
5th Oct 2021, 7:13 AM
Sarmad Saad
Sarmad Saad - avatar