Feb-24-2019, 01:49 AM
If all you are trying to do is formatted print, replace values in list below with actual values (programmatically)
and they will format properly **NOTE** requires python 3.6 or newer as it uses f-string
and they will format properly **NOTE** requires python 3.6 or newer as it uses f-string
head = '###########[b]Column[/b]####################' foot = '############################################' displaylist = [ ['#', 'Device1', 'Int1', 'description', 'remarks'], ['R', '', 'Int2', 'description', ''], ['O', '', 'Int3', 'description', ''], ['W', 'Device2', 'Int1', 'description', 'remarks'], ['#', '', 'Int2', 'description', ''] ] print(head) for item in displaylist: print(f'{item[0]:3}{item[1]:10}{item[2]:9}{item[3]:15}{item[4]:8}') print(foot)output:
Output:###########[b]Column[/b]####################
# Device1 Int1 description remarks
R Int2 description
O Int3 description
W Device2 Int1 description remarks
# Int2 description
############################################