Quoting Andrei <[EMAIL PROTECTED]>:
> You could do (I'll use 20 instead of 72 to keep it readable):
>
> >>> s = "%20s" % "xyz"
> >>> len(s), s
> (20, ' xyz')
>
> or:
>
> >>> s = "xyz"
> >>> s = s + (20 - len(s)) * ' '
> >>> s, len(s)
> ('xyz ', 20)
Just a comment ---
You can do the second exa
Vines, John (Civ, ARL/CISD) wrote on Mon, 4 Apr 2005 10:04:59 -0400:
> Hello. I have a question regarding strings. How do I format a string to be a
> specific length?
> For example I need 'string1' to be 72 characters long.
You could do (I'll use 20 instead of 72 to keep it readable):
>>> s =