Using the ConfigParser has_section () method I can check if such a section exists in the file:
config.has_section(section_name)
I wonder which team will check if the key exists . Thus, it would be possible to verify that both the section and the key exist before setting the value to the value using:
value = config.get(section, key)
Thanks in advance!
source
share