Common or centralised dictionary in python -
i looking way use common or centralised dictionary in python. have several scripts work on same data sets, different things. have dictionarys in these scripts (e.g. instrument name) used in more 1 script. if make changes or add values have make shure in scripts, of course painfull , prone errors.
is there possibility, have 1 dictionary , use in different scripts?
any appreciated - thanks.
for such situations, have general_values.py file in project root.
since lists , dictionaries use reference store values, using same dict or list in different scripts not cause problems since use same single data stored in memory.
likwise:
main_values.py my_dict = {1:1} some.py import main_values main_values.my_dict[2] = 2 other.py import main_values print main_values.my_dict >> {1:1, 2:2}
Comments
Post a Comment