Re: format string to certain line width

2008-08-13 Thread elukkien
import textwrap print textwrap.fill("HelloWorld", 2) > He > ll > oW > or > ld > > Of course if your assertion that the string contains no spaces, tabs or > newlines turns out to be incorrect this may not do what you wanted. Thanks, i just found this myself and it works fine, but very slo

format string to certain line width

2008-08-13 Thread elukkien
Hello! I'm trying to find a way to print out a long string (>400 characters no spaces, tabs or newlines) to a line width of 60 characters. So after every 60 characters a newline would start. Is it possible to transform the string to set the linewidth? for example for a linewidth of 2: >>>str = "