reading optional configuration from a file

Ben Finney ben+python at benfinney.id.au
Thu Nov 24 17:28:28 EST 2011


Ulrich Eckhardt <ulrich.eckhardt at dominolaser.com> writes:

> I have a few tests that require a network connection. Typically, the
> target will be localhost on port 20000. However, sometimes these
> settings differ, so I want to be able to optionally set them.

I subscribe to the view that an application's user-configurable settings
should be data, not executable code.

For this purpose, you will want to investigate the Python standard
library modules ‘json’ <URL:http://docs.python.org/library/json> and
‘configparser’ <URL:http://docs.python.org/library/configparser>.

-- 
 \        “I saw a sign: ‘Rest Area 25 Miles’. That's pretty big. Some |
  `\                      people must be really tired.” —Steven Wright |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list