[Tutor] what is the basic difference

Alan Gauld alan.gauld at btinternet.com
Tue Feb 7 01:17:32 CET 2012


On 06/02/12 19:12, Debashish Saha wrote:
> what is the basic difference between the commands
> import pylab as *

Are you sure you don't mean

from pylab import *

???

The other form won't work because * is not a valid name in Python.
You should ghet a syntax error.

> import matplotlib.pyplot as plt

This is just an abbreviation to save typing matplotlib.pyplot
in front of every reference to the module names.

> import numpy as np

as above

> import numpy as *

again an error.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list