![]() ![]() Here, we imported only the pi attribute from the math module. For example, # import only pi from math module We can import specific names from a module without importing the module as a whole. Hence, math.pi is invalid, and m.pi is the correct implementation. Note that the name math is not recognized in our scope. This can save us typing time in some cases. Here, We have renamed the math module as m. For example, # import module by renaming it In Python, we can also import a module by renaming it. For example, # import standard math module Suppose we want to get the value of pi, first we import the math module and use math.pi. We can import a module according to our needs. ![]() The Python standard library contains well over 200 modules.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |