How to print an element from a list of lists in python

0

I have a list of lists, like this: [('name1', size1), ('name2', size2)]

I want to just print the name of each list, how could I do that?

    
asked by anonymous 31.03.2018 / 15:20

1 answer

0

You can do this as follows:

l = [('nome1', 1), ('nome2', 2)] # Cria lista de tuplas
for t in l:
   print(t[0]) # Imprime o primeiro elemento da tupla
    
31.03.2018 / 15:48