[Tutor] about import statement

bob gailer bgailer at gmail.com
Mon Jan 10 15:34:48 CET 2011


On 1/10/2011 7:58 AM, arun kumar wrote:
> Hi Friends,
>
> I'm Arun Kumar from India, Just a month ago i started learning
> programming .learned some basics of python. I'm really enjoying
> programming in python.
>
> I have some doubts in python. When we write programs,we write some
> import statements at the beginning of the code. how to know that we
> should import something. How do we know that certain classes are in
> particular module?
Python comes with basic functionality built-in. In addition there are 
many modules included in the Python distribution to supply additional 
functionality. See the Global Module Index in the Documentation. 
Unfortunately the list is large - and many of the modules are very 
specialized.

I suggest reading (at minimum) the descriptions for collections, copy, 
decimal, exceptions, glob, itertools, math, operator, os, pickle (and 
shelve), re, shutil, sys, time.

In addition there are many many other packages for extending Python that 
are not in the distribution that add more modules.

You can also write your own modules. This is a way to
- break a complex program into smaller pieces (that often can be 
independently tested)
- create common code to be used by more than one main program.

HTH.

Please return with more questions.

-- 
Bob Gailer
919-636-4239
Chapel Hill NC



More information about the Tutor mailing list