Skip to content

Instantly share code, notes, and snippets.

@stevencombs
Last active December 20, 2015 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevencombs/6197369 to your computer and use it in GitHub Desktop.
Save stevencombs/6197369 to your computer and use it in GitHub Desktop.
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