I have a program that imports a .py file that contains lists and dictionaries and uses them in the program. I am making another program that's purpose is to change the lists and dictionaries in this database .py file (either adding or removing parts of the lists/dictionaries). How would I go about doing this? Do i need to read in the .py file line by line, modify the lists, and overwrite the document? Is there a better way?
Any ideas would be much appreciated. If overwriting the file is the best plan, how do you do that?