seldan24 wrote:

I know that Emile suggested that I can slice out the substrings rather
than do the gradual trimming of the string variable as is being done
by moving around the length.

An excellent idea.

def fold(s,chunklength):
    offset=0
    while offset<len(s):
        print s[offset:offset+chunklength]
        offset+=chunklength

s="A very long string indeed. Really that long? Indeed."
fold(s,10)


--
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Valloppillil
http://www.catb.org/~esr/halloween/halloween4.html
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to