parse a profile

J

Jason Friedman

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',
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top