I need to read the file like below:
config = {
'name': 'hello',
'see?': 'world'
}
using keys like name and see? ,but I don’t want to hard code the values in script.And how to deal with more deep nesting in this case.The file may contain more sections like this how can I recognize that ‘name’ belongs to which section at runtime.
If you encode your structure as JSON data, as I think you want and you did in the example, you just need to write and read the structure in a file.
As an example:
Configuration file saved
Configuration file reloaded