Python Notes and Examples

Config files

Here are a couple of options.

Customary-style Config Files

See the docs for configparser.

That gives you something like a map of maps. That is, you can index into it like a map, but you can’t just print the whole thing out.

Use a config.py

You can create a module containing a hashmap that can serve as a config file:

where config.py contains:

and main.py contains: