Best way to retrieve variable values from a text file?

But what i’ll love is to refer to the variable direclty, as i declared it in the python script..

Assuming you’re happy to change your syntax slightly, just use python and import the “config” module.

# myconfig.py:

var_a="home"
var_b = 'car'
var_c = 15.5

Then do

from myconfig import *

And you can reference them by name in your current context.

Leave a Comment