Pregunta

I have this list:

                 Title             ,          Rating

 [('"$weepstake$" (1979) {(#1.2)}', '10.0'), 
  ('"\'Til Death Do Us Part" (2006) {Pilot (#1.0)}', '3.7'), 
  ('"\'Conversations with My Wife\'" (2010)', '4.2')]

how print the ratings like this:

 10
 3.7
 4.2
¿Fue útil?

Solución

For each item in your list, you need the second item which is index 1:

for item in your_list:
    print(item[1])

This will give you the desired output.

Otros consejos

What about:

movies =  [('"$weepstake$" (1979) {(#1.2)}', '10.0'),   ('"\'Til Death Do Us Part" (2006) {Pilot (#1.0)}', '3.7'), 
  ('"\'Conversations with My Wife\'" (2010)', '4.2')]

print '\n'.join([movie[1] for movie in movies])
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top