Friday, August 19, 2022

wonder what is the difference between import math and from math

Hey you people, Hope you are having a lot of fun with SQL as ever. Well I have been trying my hands at python at last. Well wanted to since a decade now even before this bubble of AI and ML but yea end justifies the means. So I looked into some of the codes in the header with importing libraries just like #include in c. There were some confusing statement some stated with import and other stated with from so I went ahead and verifiied. It is not very unlike how we import libraries in C# or andy Other Lnaguage. Where you get the option of importing the whole library or the specific function. Like import math # will iclude all the function built into the class or the library of math form math import sqrt #will only import the sqrt funtion from the math class. I guess this will make the code lighter and stop and confusion when multiple classes imported have the same library. Thanks, Tushar