reference data in a dictionary
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Wed Feb 14 15:54:07 EST 2007
In <mailman.4014.1171486228.32031.python-list at python.org>, Wensui Liu
wrote:
> I know dict['row1'] will always work. but it will only get 1 row out
> of the dict. is there anyway i can get multiple (>1) rows out of dict
> by directly refeencing them, something like dict[['row1', 'row2']].
Not by directly referencing them, but with a list comprehension::
result = [the_dict[key] for key in ('row1', 'row2', 'row3')]
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list