Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

When calling ConfigParser.read you are allowed to pass a list of strings corresponding to potential locations for configuration files and the function returns a list of those files that were successfully read.

What is the default behaviour when multiple configuration files are loaded that have overlapping sections/keys? Do later files in the list override values parsed by earlier ones? Is the entire section overridden or just conflicting keys?

question from:https://stackoverflow.com/questions/4029946/multiple-configuration-files-with-python-configparser

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
409 views
Welcome To Ask or Share your Answers For Others

1 Answer

After getting around to testing it, ConfigParser overwrites the keys with each successive file, the order in which the files are read is determined by the order of the file names in the list passed to ConfigParser.read


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...