Mega Code Archive

 
Categories / Python Tutorial / Data Type
 

Use abs(z) to get its magnitude (as a float) or z real to get its real part

a=1.5+0.5j print a.real print abs(a)