newbie question: if var1 == var2:

Steve Holden steve at holdenweb.com
Thu Dec 11 14:49:23 EST 2008


Kirk Strauser wrote:
> At 2008-11-29T04:02:11Z, Mel <mwilson at the-wire.com> writes:
> 
>> You could try
>>
>> for item in fname:
>>     item = item.strip()
> 
> This is one case where I really miss Perl's "chomp" function.  It removes a
> trailing newline and nothing else, so you don't have to worry about losing
> leading or trailing spaces if those are important to you.

... and it's so hard to write

     item = item[:-1]

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list