Import ConfigParser config = configparser.ConfigParser () # operation of obtaining profile handle config.read (R & lt ' aaa.ini ' ) # specified in the configuration file read Print (config.sections ()) # obtains the profile sections all Print (config.options ( ' section1 ' )) # access to all options in the specified section Print (config.items ( ' section1 ' )) # get all keys in the specified section of the Print (config.get ( ' section2 ' , ' B1 ')) # Obtain key b1 obtained corresponding to a specified value sectionTop Print (config.getint ( ' section1 ' , ' a1 ' )) # obtain a value corresponding to the key a1 in the specified section, and converted to integer Print (config. getFloat ( ' section1 ' , ' a2 ' )) # obtain the corresponding value a2 key in the specified section, and converted to floating point Print (config.getboolean ( ' section1 ' , ' A3 ' )) # obtain the specified section a3 corresponding key value, and converted to Boolean