Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Python’s standard library includes a large range of tools for working with files on the file system, building and parsing filenames, and examining file contents.
The first step in working with files is to determine the name of the file on which to work. Python represents filenames as simple strings, but provides tools for building them from standard, platform-independent components in os.path. List the contents of a directory with listdir() from os, or use glob to build a list of filenames from a pattern.