python modules explained code example

Example 1: how to import your own function python

#For one particular fuction,
from fileName import function1()
fileName.function1()
#For multiple functions,
from fileName import function1(), function2()
fileName.function1()
fileName.function2()
#For all functions (or to remove the "fileName." prfix),
from fileName import *
function1()
function2()
function3()
#(You don't need to call all of them, I'm just demonstrating)

Example 2: modules in python

#use import statement to import modules
import random
r = random.randint(1,10)
#use from-import statements to import functions
from random import randint
r = randint(1,10)
#use from module import * statement to import all functions
from random import *
r = randint(1,10)

Example 3: modules in python

import  pandas as pd: