Login
📚 Introduction to Python Programming
Chapters ▾
⇩ Download ▾

7.6 Chapter summary

Highlights from this chapter include:

Table 7.3 Chapter 7 reference.
StatementDescription
import moduleImports a module for use in another program.
from module import functionImports a specific function from a module.
if __name__ == "__main__":A line of code found at the end of many modules. This statement indicates what code to run if the module is executed as a program (in other words, what code not to run if this module is imported by another program).
help(module_name)Shows the documentation for the given module. The documentation includes the module's docstring, followed by a list of functions defined in the module, followed by a list of global variables assigned in the module, followed by the module's file name.
help(function_name)Shows the docstring for the given function.
date(2023, 2, 14)Creates a date object representing February 14, 2023.
Requires: from datetime import date.