Convert Multiple Arrays into Rows

I have arrays as below,

(100, 'Steven', 'King'),(101, 'Queen', 'Coach'),(102, 'Lexical', 'Dean'),(103, 'Alexander', 'Hun'),...

How do I convert them into rows as like below?

100, 'Steven', 'King'
101, 'Queen', 'Coach'
102, 'Lexical', 'Dean'
103, 'Alexander', 'Hun'
...
...

1 answer

  • answered 2018-01-11 19:42 Camion

    Just print them, row by row...

    It might just be a little tricky to have the exact same format you wanted, because

    for row in table:
        print(row, sep=', ')
    

    will print tuples (with the outside parenthesis), and

    for row in table:
        print(*row, sep=', ')
    

    won't quote the strings...

    However:

    for row in table:
        print(repr(row)[1:-1], sep=', ')
    

    should do the trick