[perl-python] 20050125 standard modules

Xah Lee xah at xahlee.org
Tue Jan 25 11:13:34 EST 2005


# -*- coding: utf-8 -*-
# Python

# some venture into standard modules

import os

# print all names exported by the module
print dir(os)

# print the module's online manual
print help(os)
# the above is also available in
# interactive mode in Python terminal

# example of using a function
print 'current dir is:', os.getcwd()

# this prints a list of existing modules
print help('modules')

# referecnce
# http://python.org/doc/2.3.4/tut/node12.html

# in Python terminal, type help() then
# modules
# to get a list
# then a module name to see its doc.

# take a gander of its richness and
# suitability

--------------------------
in perl, i don't think there is one way to
list available modules.

one can write a program to find out. Start by
use Data::Dumper; print Dumper \@INC;
to see where is the standard modules located,
then search for *.pm files to get an idea.

-------------------------
Note: this post is from the Perl-Python a-day mailing list at
http://groups.yahoo.com/group/perl-python/
to subscribe, send an email to perl-python-subscribe @ yahoogroups.com
if you are reading it on a web page, program examples may not run
because html conversion often breaks the code.
Xah
 xah at xahlee.org
 http://xahlee.org/PageTwo_dir/more.html




More information about the Python-list mailing list