Import modules in Python
It's necesary and useful to developer, but exist some differences to import modules that can reduce time at the moment of compile your code.
1. If you want a wide variety of tools of a module, you can write this:
from module import *
An example of this case can be:
from math import * print sqrt(25) >>> 5.0 print cos(45) >>>0.5253219888177297
2. If you want to import all the content of module, you can write this:
import module
An example of this case can be:
import math print math.sqrt(25) >>>5.0
3. If you want to import only one tool, you can write this sentence:
from module import name
An example of this case can be:
from module import name An example of this case can be: from math import sqrt print sqrt(25) >>> 5.0
Notice the differences in the two first cases:
In the first, you only indicate the name of module to do the operation. on the contrary of the second, where you have to write the main module after the tool (math.sqrt()).
In aspects of efficiency, you should import only the necessary tools and avoid import all the module.















