I'm having an issue keeping a certain format when printing items in my list:
[TEXT1, TEXT2, TEXT3, TEXT4, TEXT5, TEXT6, TEXT7, TEXT8, TEXT9]
Expected Output: ('~' represents whitespace in the document)
~~~~~~~~~~TEXT1, TEXT2, TEXT3, TEXT4, TEXT5,
~~~~~~~~~~TEXT6, TEXT7, TEXT8, TEXT9
The issue I'm experiencing is appending TEXT2 after TEXT1, without re-adding the whitespace('~').
a = ['A121', 'A221', 'A321', 'A421', 'A521', 'A621', 'A721', 'A821', 'A921']
for v in a:
counter = 0
if counter == 5:
print '\n'
print " {},".format(v.ljust(0)),
Output:
A121 A221 A321 A421 A521 A621 A721 A821 A921
Expected output:
A121, A221, A321, A421, A521,
A621, A721, A821, A921