Last active
December 20, 2015 21:28
-
-
Save stevencombs/6197369 to your computer and use it in GitHub Desktop.
Python module basics
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
# Collection of notes that describe module and function useage | |
# Dr. Steven B. Combs, coding novice | |
# Import basics | |
import module # Imports a module | |
from module import function # Imports a single function from a module | |
from module import * # Imports all functions from a module | |
# Import samples | |
import math # Imports the math module | |
from math import sqrt # Import only the sqrt function from the math module | |
# Print all math (or any other module) functions in the console | |
import math # Sets everything to a list of things from math | |
print dir(math) # Prints 'em all! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment