Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Python module basics
# 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
You can’t perform that action at this time.