# If you want to include code form other file, just import it using file name
# without .py extension as identifier
import complex
print complex.Complex
# Or import just that indentities you need leaving other untouched
from complex import Complex
print Complex
# Or like here, list them by coma
from json import load, dump
# * will help you to import all indenties
from csv import *
# as statement will give you a power to assign a name to imported module or its part
import math as M
print M.e, M.pi
class Complex:
"""Class of complex number, details as usually:
https://en.wikipedia.org/wiki/Complex_number"""
def __init__(self, re, im=0):
self.re = re
self.im = im
def __repr__(self):
return "{re} + {im}i".format(re=self.re, im=self.im)
@property
def abs(self):
return (self.re**2 + self.im**2)**0.5