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 example using string formatting as well:
>>> s = '%-20s' % 'xyz'
>>> s, len(s)
('xyz ', 20)
--
John.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor