perl chomp equivalent in python?

Will Ware wware at
Sun Feb 13 19:55:51 CET 2000

Samuel A. Falvo II (kc5tja at wrote:
: That was the first message of the thread I ever saw, so I had no idea.
: Ain't Usenet great?  :(

Try to get caught up. Click on "Power Search", type
"comp.lang.python" where it asks for a newsgroup, and "perl chomp"
where it asks for keywords. A couple more clicks and you should
see the thread laid out in nicely chronological order.

The gist of the thread (at least from my perspective, as somebody
fishing for an elegant Python idiom) has been to find a way to
clean up loops like this:

for L in inputfile.readlines():
	# oops, it has a terminating newline
	L = L[:-1]     # that was ugly, and I don't know if it's portable stuff with L....

-- I can picture in my mind a world without war, a world without hate. And --
-- I can picture us attacking that world, because they'd never expect it.  --
Will Ware - N1IBT - wware at

More information about the Python-list mailing list