6. Libraries - JulTob/Python GitHub Wiki

To Import libraries with their functionalities use

import <library>

import <library> as <alias>

from <library> import *

from <library> import <element>

from <library> import <element>,<element>

from <library> import <element> as <element_alias>
from numpy.random import random as rng
rng() # random number generator

Some useful libraries:

math  : For mathematical functions.
urllib

Directive

We can look for which functions are implemented in each module by using the dir function:

dir(urllib)

Help

When we find the function in the module we want to use, we can read about it more using the help function, inside the Python interpreter:

help(urllib.urlopen)
⚠️ **GitHub.com Fallback** ⚠️