[英]Python get diff for ConfigParser
假設我已經初始化了新舊配置
from ConfigParser import ConfigParser
old_config = ConfigParser()
old_config.read(config_file1)
new_config = ConfigParser()
new_config.read(config_file2)
如何獲得這兩個配置之間的區別?
您可以使用以下命令將每個配置實例轉換成字典:
old_dict = old_config._sections
new_dict = new_config._sections
然后使用:
set(old_dict.items()) ^ set(new_dict.items())
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.