Newbie on importing

Roger morris_r at 4j.lane.edu
Fri Jun 20 20:19:10 CEST 2003


Around Fri,Jun 20 2003, at 02:11,  jwsacksteder at ramprecision.com, wrote:
> That example is still less than clear...
> 
> >import sys
> >
> >Imports the module named 'sys'.
> 
> Which get me access to what in 'sys'?
> 
> >from sys import *
> >
> >Imports all names from sys (including names referring to functions).
> 
> Likewise, what additional thing are available when doing this? 
> Is 'import sys' a subset of 'from sys import *'?
> 
with 
import sys

To access a function 'blah', you would have to refer to it:
sys.blah()

If you use like this:
from sys import *

Then to access the function blah, you would just refer to it:
blah()

If 'blah' is the only thing in sys you want, you could do this:
from sys import blah
Then:
blah()

-- 
Roger 
morris_r at 4j.lane.edu






More information about the Python-list mailing list