Is there a way to write this line of code in a better way :
"""{a};{b};{c};{d}""".format(a = myDictionary[a], b = myDictionary[b], c = myDictionary[c], d = myDictionary[d])
something like this ?
"""{a};{b};{c};{d}""".format(myDictionary)
format can dereference its parameters:
>>> D=dict(a=1,b=2,c=3,d=4)
>>> '{0[a]};{0[b]};{0[c]};{0[d]}'.format(D)
'1;2;3;4'
A similar syntax can be used on classes:
>>> class C:
... a=1
... b=2
... c=3
... d=4
...
>>> '{0.a};{0.b};{0.c};{0.d}'.format(C)
'1;2;3;4'
See the Format Specification Mini-Language.