0

I have a list that stored with tuples and I want to print the first item in my tuples

[('RFI', 3704568), ('Le_Figaro', 3590616), ('BFMTV', 3502710), ('libe', 3391929), ('le_Parisien', 3034184), ('Mediapart', 2920291), ('20Minutes', 2535950), ('franceinfo', 2123105), ('Europe1', 1601581), ('lobs', 1519439)]

This is my list and I want to print the text part.

for key in top_10_followed:
    top_10_followed_accounts = top_10_followed[key]
    print(top_10_followed_accounts)

I wrote that code but I had this error message

TypeError Traceback (most recent call last) in 1 for key in top_10_followed: ----> 2 top_10_followed_accounts = top_10_followed[key] 3 print(top_10_followed_accounts) TypeError: list indices must be integers or slices, not tuple

Is there any other ways to get the first part of each tuple on my list

samet.bnc
  • 3
  • 2

0 Answers0