I asked a question about how to take A_board=[['0', '0'],['1', '1']]. And I want to take this nested list apart and get a result, which if I call print result, it would display: < 0 0 > < 1 1 >.
I was told to use ' '.join('< {} {} >'.format(*items) for items in A_board), but this only works for two tuples, it is not flexible. What if I have a [[0],[0],[0]] and want to make it into < 0 > < 0 > < 0 > ? Right now I have to type in an extra {} everytime the len(A_board) increases.
ex. if A_board length is 2, then there will be two {}‘s
if A_board length is 3, then there will be three {}‘s
what is a better way to do this?
Thanks.
You could just do another join:
which will work for any length of
items.