I’ve been working on a project and I’ve reached a sticking point. I have a dictionary that contains both key-value pairs and nested dictionaries, as in the following:
{|{tiff}|:{YResolution:144.0, ResolutionUnit:2, XResolution:144.0}, |{exif}|:{PixelXDimension:2640, PixelYDimension:2068, UserComment:“Screenshot”}, ProfileName:“DELL P2415Q”, DPIWidth:144.0, PixelHeight:2068, DPIHeight:144.0, ColorModel:“RGB”, Depth:8, HasAlpha:true, |{png}|:{InterlaceType:0, XPixelsPerMeter:5669, YPixelsPerMeter:5669}, PixelWidth:2640}
I need to flatten the dictionary to the following:
{YResolution:144.0, ResolutionUnit:2, XResolution:144.0, PixelXDimension:2640, PixelYDimension:2068, UserComment:“Screenshot”, ProfileName:“DELL P2415Q”, DPIWidth:144.0, PixelHeight:2068, DPIHeight:144.0, ColorModel:“RGB”, Depth:8, HasAlpha:true, InterlaceType:0, XPixelsPerMeter:5669, YPixelsPerMeter:5669, PixelWidth:2640}
The key names of the nested dictionaries (e.g. |{tiff}|) varies from one running of the script to another. Thanks