You can chop off anything past 72 characters with:
s2 = s[:72]
On Apr 4, 2005, at 7:04 AM, Vines, John (Civ, ARL/CISD) wrote:
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.
Thanks for your time,
On Apr 4, 2005, at 16:04, Vines, John (Civ, ARL/CISD) wrote:
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.
Thanks for your time,
John
You can use the string methods ljust, rjust and zfill:
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.
Thanks for your time,
John
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/li