Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (30 sloc) 600 Bytes

Python

Import

thanks

Example, we have a lib called module.py

# module.py

def fun1(n):
  return n+1

There are four way to import module.py

1- import

import module

module.fun1(1000) #1001

2- from

from module import fun1

fun1(1000) #1001

3- import *

from module import *

fun1(1000) #1001

4- import as

import module as lib

lib.fun1(1000) #1001