On Aug 13, 10:13 pm, [EMAIL PROTECTED] wrote:
> 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.
>
[EMAIL PROTECTED] wrote:
Thanks, i just found this myself and it works fine, but very slow...
The script without the wrapping takes 30 seconds, with wrapping 30
minutes. Is there not a more efficient way?
sounds like you're wrapping a few million long strings, not just one...
here are two app
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
[EMAIL PROTECTED] wrote:
> 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
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 = "