python的configparser模块可以用来生成/处理类似下面的配置文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
[Section1] Option1 = 1 Option2 = 2 DoNotList = 1 [Section2] Option3 = 3 Option4 = 4 MustDisplay = 1 2 3 [Section3] Option5 = 5 Option6 = 6 |
今天要做的是通过configparser模块读取已有的ini文件并过滤出需要的section项,需求很简单,提取满足如下条件的section名字: 1.包含DoNotList项且值不为0 2.不包含DoNotList项但是包含了MustDisplay项 […]