[Tutor] Easy Problem

Dave Kuhlman dkuhlman at rexx.com
Wed Sep 2 01:01:13 CEST 2009


On Mon, Aug 31, 2009 at 06:43:29PM -0700, Ishan Puri 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?

Not quite what you are asking for, but, if you are working with
this kind of problem, you might want to know about the textwrap
module in the standard library:

    http://docs.python.org/library/textwrap.html#module-textwrap

- Dave


-- 
Dave Kuhlman
http://www.rexx.com/~dkuhlman


More information about the Tutor mailing list