0

I have a list containing tupels, i.e.

df = [('apa', 'apc'), ('apa', 'bp'), ('br', 'bpt')]

with

df[0]

I would get

('apa', 'apc')

How could I get 'apa' only from that tuple?

eternity1
  • 631
  • 1
  • 12
  • 30

1 Answers1

0

I believe you are looking for this:

a, b = df[0]

which in case of your data would set value of a to apa and b to apc. If you want just to get apa from your tuple, then refer as you'd with lists:

a = df[0][0]
Marcin Orlowski
  • 68,918
  • 10
  • 117
  • 136