Newbie problem with lists

Rene Pijlman reageer.in at de.nieuwsgroep
Fri Feb 28 04:38:39 EST 2003


Jacob H:
>	if (wordlen + charcount + 1) > colwidth:
>            lines.append(text)

Did you verify that the condition is actually met in all cases
you expect it to be?

>    for i in range(0, len(lines)):

    for line in lines:

is easier and more readable.
        
>What I expect to get is a list of formatted lines that all display.
>Instead, I get only one element to display - as if I'd written print
>lines[0].

What input did you provide to this function? I'm getting 0 lines
when I call it like this:

    render_text("foo bar\nfoo bar")

May I suggest you post the complete executable code next time?
Including the import, print statement and actual call to the
function. That will help people to reproduce it easily and you
will probably get a solution in hours instead of days :-)

-- 
René Pijlman

Wat wil jij leren?  http://www.leren.nl




More information about the Python-list mailing list