[Tutor] ASCII characters

Kent Johnson kent37 at tds.net
Tue May 24 11:46:25 CEST 2005


John Carmona wrote:
> I need to print all the ASCII characters within a string, how would I 
> delimit for example to print the first 100 only? Many thanks

A string is a sequence and supports sequence operations including slices. So
   s[:100]
gives the first 100 chars of a string.

You might be interested in the textwrap modulue.

Kent



More information about the Tutor mailing list