June 2000
Intermediate to advanced
556 pages
8h 45m
English
Python programs can consists of many files. Each file is known as a module. To gain access to the contents of a Python module, import the module by using the import keyword.
Python comes with a vast array of modules which, by default, live in the python/lib subdirectory.
The following example imports the string module and calls the upper function it provides. This function converts a string to all uppercase characters.
CD-ROM reference=5024.txt >>> import string >>> print string.upper ("Hello World") HELLO WORLD >>>
Python is case sensitive. This case sensitivity applies to keywords, variables, and modules.
The following statement fails because Import is not a keyword.
CD-ROM reference=5025.txt
>>> Import string Syntax Error: ...Read now
Unlock full access