Keepin constants, configuration values, etc. in Python - dedicated module or what?

Rustom Mody rustompmody at gmail.com
Tue Sep 30 09:15:39 EDT 2014


On Tuesday, September 30, 2014 5:18:31 PM UTC+5:30, Chris wrote:

> I would actually
> quite like to keep the configuration data separate from the code as it
> would simplify using the data at the 'home' end of things as I'd just
> need to copy the configuration file across.  This was why the database
> approach appealed at first as all I need to do is copy the database
> and everything is in there.

Of course

> Are there any better ways of doing this?  E.g. some sort of standard
> configuration file format that Python knows about? 

Umm this is getting to be a FAQ...
Maybe it should go up somewhere?

Yes there are dozens:
- ini
- csv
- json
- yml
- xml
- pickle
- And any DBMS of your choice

I guess Ive forgotten as many as Ive listed!!



More information about the Python-list mailing list