python3 compare ini file type configuration program

ini configuration file type has a feature that a configuration packet, each with a section, the following section is in the form of key-value pairs, comparing before and after python3 configuration change and after upgrade scheme:
The first step: the section and the following the key to bind
file1 file2

List, a list of each section is composed of each dictionary
section written: tag = name of the section of form
to traverse each group file2 tag list
each time taken to tag a group went to find the list of file1
file1 list may the first tag value to the collection as a list
as long as file2 take the tag list tag is not in traversed in file1

If so, it is easy to get to key in this section file2 set of dictionaries,
the key is the key under file1 list section on how to take?
Take the same tag value to the value in file2 find
each iteration file2 section in each group, and then determine the value of this tag is not in the section of the tag in this group,
if he would pop out, so you get file1 this is a matching tag group dictionary
that remains is to find these two sets of keys for different packages a comparison function call, and prints out which key section which is located under different

If not, this is a new direct reports, this group under the direct printing of the dictionary

Guess you like

Origin blog.51cto.com/13560219/2450976