newbie question: if var1 == var2:

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Thu Dec 11 15:09:51 EST 2008


On Thu, 11 Dec 2008 13:44:22 -0600, Kirk Strauser wrote:

> At 2008-12-11T17:24:44Z, rdmurray at bitdance.com writes:
> 
>>     >>> '  ab c  \r\n'.rstrip('\r\n')
>>     '  ab c  '
>>     >>> '  ab c  \n'.rstrip('\r\n')
>>     '  ab c  '
>>     >>> '  ab c  '.rstrip('\r\n')
>>     '  ab c  '
> 
> I didn't say it couldn't be done.  I just like the Perl version better.

def chomp(s):
    return s.rstrip('\r\n')


And now you have chomp.



-- 
Steven



More information about the Python-list mailing list