How to eval a file

Alexander Schmolck a.schmolck at gmx.net
Sat Feb 22 12:38:52 EST 2003


Alexander Schmolck <a.schmolck at gmx.net> writes:

> > Is there another way?
> 
> Yes. Doing it properly (without any exec*s). If your configuration file just
> looks like
> 
>  var1 = '''some string'''
>  var2 = '''some other string'''
> 
> then parse it, it isn't particularly difficult.
> 

Or, even simpler, use the ConfigParser module (which parses files that look
like windoze ini files).

alex




More information about the Python-list mailing list