R. David Murray added the comment:
Actually, we more or less already do have this function in the stdlib, (I'd
guess it is for pretty much the same reason that QT has it), except ours can
also truncate sensibly to a given width:
>>> import textwrap
>>> textwrap.shorten(' lots\t of\nwhites
Serhiy Storchaka added the comment:
This is too specialized function to be included in the stdlib ar added as a
method to base class.
There are simpler and faster implementations of this function:
def simplify(s):
return ' '.join(s.strip().split())
or
def simplify(s):
New submission from Tobias Leupold:
It would be nice if a function equivalent to Qt's QString::simplified() would
be added to Python's strings (cf.
http://qt-project.org/doc/qt-4.8/qstring.html#simplified ).
I'm not sure if my approach is good or fast, but I added this function to my
code lik