[Tutor] Exploring the Standard Library

bhaaluu bhaaluu at gmail.com
Sun Jul 6 19:43:27 CEST 2008


On Sat, Jul 5, 2008 at 2:23 PM, Nathan Farrar <nathan.farrar at gmail.com> wrote:
> I'd like to spend some time exploring the standard library.  I'm running
> python on Ubuntu.  How would I find the location of the modules (find /
> -name "os.py" does not yield results)?
>
> Thanks!
> Nathan
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

I'm running a standard Debian 4.0r3 Stable with Python 2.4.4.
I've found the to be helpful. Open a Konsole or Terminal.

[~]$ python

Python 2.4.4 (#2, Apr 15 2008, 23:43:20)
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> help('modules')

Please wait a moment while I gather a list of all available modules...

[Modules are spooged here.]

Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose descriptions contain the word "spam".

>>> help('os')

The help screen for 'os' comes up. Press the spacebar to scroll through it.

>>> help()

Welcome to Python 2.4!  This is the online help utility.

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://www.python.org/doc/tut/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics".  Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".

help> quit

>>> Ctrl-D

[~]$

Another thing that comes in very handy is 'dir(name_of_module)'.
Doing your exploration in the interactive interpreter allows you to read up
on a module, then try it. Have a Konsole with the Python interactive interpreter
and a browser open to the docs at the same time, and really go to town with it!

And so forth, and so on....... as you can see, Python itself has an incredible
help engine built-in to the interactive intepreter.

Happy Programming!
-- 
b h a a l u u at g m a i l dot c o m
In a world without fences, who needs Gates?


More information about the Tutor mailing list