How Compare and fetch the data from two dictionary items in Python

I want to fetch the data by comparing two dict items in python:

dict1:

rawdata = {
"node1":["id1",["set1a"]],
"node2":["id2",["set1b"]]
  }

dict2:

subdata = {
"info1":["set1a","id1","firstset","firstsection"]
"info2":["set1b","id2","secondset","secondsection"]
}

As one can see the raw data has the subdata values but not the complete information. I want to compare dict1 with dict2 to get the complete details and print the output to another dictionary like:

"node1":"id1","set1a","firstset","firsstsection",
"node2":"id2","set1b","secondset","secondsection"

By using prettytable, I want to print the information fetched from the final dictionary in tabular format. Could someone help me to solve this.



Read more here: https://stackoverflow.com/questions/68475032/how-compare-and-fetch-the-data-from-two-dictionary-items-in-python

Content Attribution

This content was originally published by Karthik at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: