-1

I have a list of tuple where I want to print out key value of a certain element, like this.

tupple_list = [("abc", 10),
               ("cbb", 20),
               ("Abba", 30)]
print(tupple_list[-1])

The result will become

("Abba", 30)

How can I only get Abba without brackets?

Abba

1 Answers1

-1

The inner elements are tuples so you can use further indexing as:

print(tupple_list[-1][0])
Krishna Chaurasia
  • 8,924
  • 6
  • 22
  • 35