perl chomp equivalent in python?
Hrvoje Niksic
hniksic at iskon.hr
Thu Feb 10 03:25:34 EST 2000
More information about the Python-list mailing list
Thu Feb 10 03:25:34 EST 2000
- Previous message (by thread): perl chomp equivalent in python?
- Next message (by thread): perl chomp equivalent in python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
François Pinard <pinard at iro.umontreal.ca> writes: > if line and line[-1] == '\n': > line = line[:-1] > > You may remove the test for line if you know that it is not empty. Or: if line[-1:] == '\n': line = line[:-1] That works with both empty and non-empty lines.
- Previous message (by thread): perl chomp equivalent in python?
- Next message (by thread): perl chomp equivalent in python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list