Modules in Python
In this post, you will learn how to work with modules so that you can use that same knowledge and thus evolve.
- modules are basically objects with attributes that can be linked through a reference;
- they allow you to group your code, which makes everything easier to understand and use;
||Returns an ordered list of strings containing the names defined in the module in question|
- this same list contains the names of all variables and functions that were defined in that same module.
# import math # from math import sqrt from math import * # print('Module content:', dir(math)) # print('sqrt function:', sqrt(10)) print('pi value:', pi) # pi value: 3.141592653589793