Python ConfigParser Checking existence of both Section and Key Value Python ConfigParser Checking existence of both Section and Key Value python python

Python ConfigParser Checking existence of both Section and Key Value


In addition to has_section, there is also a has_option method:

config.has_option(section, option)

From the Python documentation:

has_option*(section, option)*
If the given section exists, and contains the given option, return True; otherwise return False. If the specified section is None or an empty string, DEFAULT is assumed.