How can you format variable length strings into uniform columns in python? I'm reading data from a database into columns (2 columns total) and I am trying to left-align the first column and right-align the second using python format().
Here is the code I am currently using:
cur.execute("SELECT * FROM test")
for items in cur:
list_box.insert(1, "{:1<50}{2:>58}".format(
items[0], str(items[1])))
Here is the current result:
No matter what values I try in format() the dates will not right-align uniformly.
