python - Work with tuple of dictionaries -


i have following tuple of dictionaries:

td=({'associatedframe': none,      'cyclicmodenumber': none,      'description': 'increment     10: arc length =   7.2813e-02',      'domain': 'arc_length',      'fieldoutputs': 'repository object',      'frameid': 10,      'framevalue': 0.0728124976158142,      'frequency': none,      'incrementnumber': 10,      'isimaginary': false,      'loadcase': none,      'mode': none}) 

i'd value associated key frameid. don't have many experience tuples , dictionaries , questions i've found dictionaries of tuples, ask help. thanks

edit: had tried solution forgot mention i'm using python results program. program has specific organisation in order work had write td.frameid.

if have, dictionary.

td['frameid'] 

will work. parenthesis don't make tuple. comma makes tuple.

foo = (1) #integer foo = (1,) #1 element tuple foo = 1, #1 element tuple 

parenthesis necessary in few situations syntax otherwise ambiguous (like function calls). clearly:

foo(1,2,3) 

is different than;

foo(1,(2,3)) 

if have tuple, need index dictionary can index item want.

td[0]['frameid'] 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -