perl chomp equivalent in python?
Nathan Clegg
nathan at islanddata.com
Thu Feb 10 12:03:32 EST 2000
On 10-Feb-2000 Will Ware wrote:
> I often find myself doing things like this inside 'for
> ...readlines():'
> loops, and it always strikes me as cheesy and inelegant. It'd be
> kinda
> cool if readlines() could take an argument that meant to strip away
> any trailing whitespace.
Why not use string.rstrip() ???
for line in map(string.rstrip, f.readlines()):
....
----------------------------------
Nathan Clegg
nathan at islanddata.com
More information about the Python-list
mailing list