Python strings have rjust(), ljust() and center() methods that allow strings to be padded with spaces.
s = "123".rjust(5) assert s == " 123" s = "123".ljust(5) assert s == "123 " s = "123".center(5) assert s == " 123 "
Python strings have rjust(), ljust() and center() methods that allow strings to be padded with spaces.
s = "123".rjust(5) assert s == " 123" s = "123".ljust(5) assert s == "123 " s = "123".center(5) assert s == " 123 "