cgi - cleaning tabs and returns out of textarea

Bengt Richter bokr at oz.net
Mon Jan 28 21:12:59 EST 2002


On Mon, 28 Jan 2002 18:09:19 -0600, "Jason Orendorff" <jason at jorendorff.com> wrote:

>Glenn Stauffer wrote:
>> Thanks for the other suggestions.  I'll have to play around with 
>> it more and see what works best.
>
>This works best:
>
>def clean(text):
>    return ' '.join(text.split())
>
Of course that collapses all contiguous runs of white space,
including tabs, to single spaces -- which may be what he
really wanted, but then, what was the tab_width arg for?

>Don't use re unless you have to.
Sure. As usual, the most of the trick is in defining requirements ;-)

His problem might also change depending on the presence of 
a WRAP attribute (and value if any) for the textarea input.
Note that NN & IE value options aren't exactly the same.
He might want to experiment if he's writing the HTML.

Regards,
Bengt Richter




More information about the Python-list mailing list