I have a dict which looks something like
A = {
'test1':{'q0':[0.123,0.234],'phi0':[0.124,0.4325],'m':[9.42,0.3413]},
'test2':{'q0':[0.343,0.353],'phi0':[0.2341,0.235]},
'test3':{'q0':[0.343,0.353],'phi0':[0.2341,0.235],'m':[0.325,0.325],'z0':[0.234,0.314]}
}
I want to print each individual dictionary:
'test1': q0=0.123(0.234) phi0=0.123(0.4325) m=9.42(0.3413)
'test2': q0=0.343(0.353) phi0=0.2341(0.235)
'test3': z0=0.234(0.314) q0=0.343(0.353) phi0=0.2341(0.235) m=0.325(0.325)
How to do so in Python 3 using thestring.format()? Since each sub-dictionary has variable number of 'parameters', I am not sure how to accomplish it using some list/dictionary comprehension. Also, if I want to leave some space if that parameter is missing like what is shown, how do I do it? Each dictionary has at most five different parameters (q0,phi0,m,c,z0). I juts print it to the terminal so I don't need something very fancy, but I hope it can be more readible.