Answers for "Read an integer value from a configuration file"

0

Read an integer value from a configuration file

import ConfigParser
config = ConfigParser.ConfigParser()
config.read("integers.ini")

print config.get("Integers", "b")Output5
print type(config.get("Integers", "b"))Output<type 'str'>

print config.getint("Integers", "b")Output5
print type(config.getint("Integers", "b"))Output<type 'int'>
Input Filesintegers.ini
Posted by: Guest on February-25-2020

Browse Popular Code Answers by Language