Learning Python : >>> import math doesn't work ?

Terry Reedy tjreedy at udel.edu
Mon Nov 19 17:14:28 EST 2007


"Asun Friere" <afriere at yahoo.co.uk> wrote in message 
news:8622a96d-5f70-475d-aa0e-8d7d9eb1771a at s36g2000prg.googlegroups.com...
| On Nov 19, 3:46 pm, windspy <wind... at gmail.com> wrote:
| > use it like: x = math.sqrt (100) and math.sin(x)
|
| alternatively import like this:
|
| from math import sqrt, sin
|
| ... and use it like you have.

Or,
import math as m # to save typing, especially in interactive mode
x = m.sin(1) #etc 






More information about the Python-list mailing list