Last active
April 5, 2020 21:19
-
-
Save marta-krzyk-dev/ffe8237e0521da3a96259e1854b17892 to your computer and use it in GitHub Desktop.
Python module import
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This is ecommerce/__init__.py file | |
#If there is a __init__.py in a folder, it makes it a package :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Import single function | |
#from ecommerce.shipping import calc_shipping | |
#calc_shipping() | |
#Import single module | |
#import ecommerce.shipping | |
#ecommerce.shipping.calc_shipping() | |
#Import single module, skip package name | |
from ecommerce import shipping | |
shipping.calc_shipping() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ecommerce/shipping.py | |
#Function inside shipping module | |
def calc_shipping(): | |
print("calc_shipping") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment