一、configparser
a. Reading
1. 实例化:configparser_handle = configparser.ConfigParser();
2. 读入:configparser_handle.read("config_document.cfg");
3. Get Title: configparser_handle.sections ();
4. Get the list Title: item_list = configparser_handle.items ( 'term')
5. The method of acquiring the character value: configparser_handle.get ( 'term', 'name');
6. The method of obtaining the integer value: configparser_handle..getint ( 'term', 'number');
7. A method for obtaining Boolean: configparser_handle..getboolean ( 'term', 'number');
8. A method for obtaining float value: configparser_handle..getfloat ( 'term', 'salary');
b. Write
1. 实例化:configparser_handle = configparser.ConfigParser();
2. 读入:configparser_handle.read("config_document.cfg",encoding = "utf-8);
3. Delete entire message: configparser_handle.remove_section ( "section_test_one");
4. Remove the specified information in the block information: configparser_handle.remove_option ( "section_test_two", "key_three");
5 determines whether there is "section_test_one": configparser_handle.has_section ( "section_test_one");
6. determines whether there is "section_test_one" "key_one": configparser_handle.has_section ( "section_test_one", "key_one");
7. 添加section:configparser_handle.add_section("section_new");
8. 在'section_new'中添加"key_one='gangzi':configparser_handle.set("section_new","key_one","gangzi");
9. Finally, the written content written to the file, complete the final write: configparser_handle.write (open ( "config_document.write", "w")).