简体   繁体   中英

Iterating through list within a list and only outputs last value

I have multiple lists (Strategies) of chess moves in one big list that are being iterated through, move by move.

for list in Strategies:
           for j in list:
               self.move_sequence = j

It is only outputting the last move in the entire list, but I would like to start from the first move and move towards the end one-by-one. Thanks for any help!

Like this?

for list in Strategies:
    
    for j in list:
       self.move_sequence += j
       
    print(self.move_sequence)
    self.move_sequence = ''

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM