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
  • 651
  • 2
  • 15
  • 31

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
  • 72,056
  • 11
  • 123
  • 141