regular expresson for Unix and Dos Lineendings wanted

Sion Arrowsmith siona at chiark.greenend.org.uk
Fri Feb 24 09:12:05 EST 2006


Franz Steinhaeusler  <franz.steinhaeusler at gmx.at> wrote:
>On Thu, 23 Feb 2006 13:54:50 +0000, Martin Franklin
>>why not use string methods strip, rstrip and lstrip
>because this removes only the last spaces,
> [given r = 'erewr    \r\nafjdskl     ']
>I want:
>'erewr\r\nafjdskl'

os.linesep.join(l.rstrip() for l in r.split(os.linesep))

-- 
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |    -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump



More information about the Python-list mailing list