>>> rows = """234 127 34 23 45567
... 23 12 4 4 45
... 23456 2 1 444 567"""
first convert the rows into a 2d array (list of lists)
>>> arr=[x.split() for x in rows.split("\n")]
now compute the space each field will need to fit into
>>> widths = [max(map(len,(f[i] for f in tab))) for i in range(len(arr[0]))]
and pad each element to fit into that space
>>> [[k.rjust(widths[i]) for i,k in enumerate(j)] for j in arr]
[[' 234', '127', '34', ' 23', '45567'], [' 23', ' 12', ' 4', ' 4', ' 45'], ['23456', ' 2', ' 1', '444', ' 567']]
finally join the array back into a string
>>> print "\n".join(" ".join(k.rjust(widths[i]) for i,k in enumerate(j)) for j in arr)
234 127 34 23 45567
23 12 4 4 45
23456 2 1 444 567