How to eval a file

Donnal Walter donnal at
Sun Feb 23 22:08:50 CET 2003

Alex Martelli wrote:
> Björn Lindberg wrote:
>>I found the shlex module which made it really easy to parse my
>>configuration file, so I'm doing that now.
> OK, if you can stay away from eval/exec/execfile altogether, you'll no
> doubt be even gladder;-).

I've been thinking about making a configuration file with a syntax 
something like this:

   'log': './error.txt'
   'splash': './welcome.png'
   'icon': './prism.ico'
   'login': 'C:/prism/user.dbm'
   'cabinet': 'C:/prism/patient.dbm'

Then I planned on reading the file something like this:

         f = open(filename)
         txt ='\r\n','\n')

Do I understand your previous reply to Björn to mean that I would still 
be better off using ConfigParser?

Donnal Walter
Arkansas Children's Hospital

More information about the Python-list mailing list