accessing elements of a tuple

Matthew Sacks ntwrkd at
Fri Jan 30 23:23:31 CET 2009

let me re-phrase that question:
i would like to access the element of individual tuples inside of a
list, by using an index.
so i have the list contents

print list
[('--datasourcename', 'DB'), ('--password', '123')]

How can I access "DB" from the list directly using an index?

right now I would have to grab the tuple and the use the index of the tuple

On Fri, Jan 30, 2009 at 2:20 PM, Matthew Sacks <ntwrkd at> wrote:
> i am trying to access elements of a tuple without using the [1:5] notation.
> the contents of the tuple are as follows:
> ('--datasourcename', 'DB')
> I want to access everything in the second argument, but i am not sure
> how to go about this without converting to a string.
> thanks in advance

More information about the Python-list mailing list