On Sun, Mar 31, 2002 at 04:58:31AM -0600, Colin Watson wrote:
| On Sat, Mar 30, 2002 at 02:31:06PM -0600, dman wrote:
 
| > #!/usr/bin/env python
| > 
| > import sys
| > p = []
| > for line in sys.xreadlines() :
| >     l = line.strip() # strip all leading and trailing whitespace
| >     if l :
| >         p.append( l )
| >     else :
| >         print " ".join( p )
| >         # uncomment the next line if you want a blank line in between 
paragraphs.
| >         #print
| >         p = []
| 
| You'll probably miss the last paragraph that way, although I haven't
| tested yours either. :)

Hmm, yeah, unless there is at least one blank line after the last
paragraph.

| (Do you mean sys.stdin.xreadlines()?)

Yeah.

-D

-- 

If we claim to be without sin, we deceive ourselves and the truth is not
in us.
        I John 1:8


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to