Re: [Tutor] building strings of specific length

2005-04-04 Thread Mike Hall
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,

Re: [Tutor] building strings of specific length

2005-04-04 Thread Max Noel
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:

[Tutor] building strings of specific length

2005-04-04 Thread Vines, John (Civ, ARL/CISD)
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