[Tutor] Easy Problem

Luke Paireepinart rabidpoobear at gmail.com
Tue Sep 1 04:22:42 CEST 2009


>>> txt = "Hi          how are you?"
>>> " ".join(txt.strip().split())
'Hi how are you?'

On Tue, Sep 1, 2009 at 3:43 AM, Ishan Puri <ballerz4ishi at sbcglobal.net>wrote:

> Hello,
>     I have 2 plain text documents that have uneven spacing. I need to make
> these single spaced between lines and between words. Basically I need to get
> them to be equal character length after I abridge the uneven spacing. In
> Python there is probably one simple command for this for a text file? How do
> I do this?
> E.G.: Hi          how are you?
> Fixed: Hi how are you?
>         Thanks,
>                 Ishan
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090901/183a14f6/attachment.htm>


More information about the Tutor mailing list