parse a profile

Jason Friedman jason at powerpull.net
Sat Feb 18 11:34:38 EST 2012


I have a file I use for shell scripts that looks like this:

export VAR1=/path/to/dir
export VAR2=7
export VAR3=${VAR1}/further/path
# comment
. /another/file

And a file /another/file:
export VAR4=database-name

Is there an existing package that will read such a file and return a
dictionary like this:
{
    'VAR1': '/path/to/dir',
    'VAR2': 7,
    'VAR3': '/path/to/dir/further/path',
    'VAR4': 'database-name',
}



More information about the Python-list mailing list