How do I align text output in Python?
str.format already has the possibility to specify alignment. You can do that using {0:>5}; this would align parameter 0 to the right for 5 characters. We can then dynamically build a format string using the maximum number of digits necessary to display all numbers equally: >>> lower = [70, 79, 88, 97, 106, 115] >>> … Read more