[Tutor] building strings of specific length

Mike Hall michael.hall at critterpixstudios.com
Mon Apr 4 21:17:30 CEST 2005


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,
> John
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-MH



More information about the Tutor mailing list