Python Tuple Issue -
i'm learning python tuple, , feeling bit overwhelmed. i'm working tuple 20 times size of i've put below.
{u'0usshtry': {u'a': {u'n': u'backups'}, u'h': u'0usshtry', u'k': (16147314, 17885416, 1049370661, 902515467), u'ts': 13734967, u'p': u'5rtygqws', u'u': u'xpz_tb-ydug', u't': 1, 'key': (16147314, 17885516, 10490661, 9015467)}, u'omv32igb': {u'a': {'n': 'rubbish bin'}, u'h': u'omv32igb', u'k': u'', u'ts': 13734735, u'p': u'', u'u': u'xpz_tb-ydug', u't': 4}, u'acltqtaa': {u'a': {u'n': u'test3'}, u'h': u'acltqtaa', u'k': (4031580, 13207606, 20877418,89356117), u'ts': 1373476935, u'p': u'4flnwbtb', u'u': u'xpz_tb-ydug', u't': 1, 'key': (4032580, 13208406, 20627418, 4893117)}, u'kek0rbkr': {u'a': {u'n': u'abandon ships - 5 - stange love.mp3'}, u'h': u'kek0rbkr', u'k': (4714448, 440504, 14565743l, 7910538l), u'ts': 13737027, 'iv': (4284718, 20627111, 0, 0), u'p': u'wqkyfs6s', u's': 1731926, 'meta_mac': (3010404l, 2624700l), u'u': u'xpz_tb-ydug', u't': 0, 'key': (94654, 201535, 385311l, 301074l, 42818, 204311, 3010404l, 269100l)}}
now, issue is, i'm trying access data of located in see "test3" or "abandon ships - 5 - stange love.mp3", example see "u'p': u'5rtygqws'," on first line. how go accessing these without predefining of information comes in tuple?
any apprecieated. thanks.
you can extract of data comprehensions, this:
[d[k]['a']['n'] k in d] # => [u'backups', 'rubbish bin', u'test3', u'abandon ships - 5 - stange love.mp3']
(assuming have dict (and it's dict, dan , david say, not tuple) in d
).
Comments
Post a Comment