Skip to content

Instantly share code, notes, and snippets.

@fabsta
Created August 28, 2016 20:22
Show Gist options
  • Save fabsta/decc949d91162dc1a2183ebb3b281370 to your computer and use it in GitHub Desktop.
Save fabsta/decc949d91162dc1a2183ebb3b281370 to your computer and use it in GitHub Desktop.

IMPORTS

'generic import' of math module

import math
math.sqrt(25)

import a function

from math import sqrt
sqrt(25)    # no longer have to reference the module

import multiple functions at once

from math import cos, floor

import all functions in a module (generally discouraged)

from os import *

define an alias

import numpy as np

show all functions in math module

dir(math)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment