Question

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
Était-ce utile?

La solution

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.

Autres conseils

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])
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top