[Python-Dev] chomp()?

Moshe Zadka moshez@zadka.site.co.il
28 Dec 2000 16:51:32 -0000


On Thu, 28 Dec 2000, Guido van Rossum <guido@digicool.com> wrote:

> Someone just posted a patch to implement s.chomp() as a string method:
...
> Any comments?  Is this needed given that we have s.rstrip() already?

Yes.

i=0
for line in fileinput.input():
	print '%d: %s' % (i, line.chomp())
	i++

I want that operation to be invertable by

sed 's/^[0-9]*: //'