Use getboolean() :
print config.getboolean('main', 'some_boolean') print config.getboolean('main', 'some_other_boolean')
From the Python manual:
RawConfigParser.getboolean(section, option)
A convenience method that forces an option in a specified section to a boolean value. Please note that the accepted values ββfor the option are "1", "yes", "true" and "on", which cause this method to return True, and "0", "no", "false" and "off", which force it to return False. These string values ββare case-insensitive. Any other value will raise a ValueError.
The bool() constructor converts an empty string to False. Non-empty lines are True. bool() does nothing special for "false", "no", etc.
>>> bool('false') True >>> bool('no') True >>> bool('0') True >>> bool('') False
source share