list iteration question

Fredrik Lundh effbot at
Wed Feb 16 22:40:14 CET 2000

David R. Favor <dfavor at> wrote:
> In the attached code, would someone point out why the function
> chomp4() throws an exception?

well, didn't your python interpreter just do that:

Traceback (innermost last):
  File "", line 52, in ?
  File "", line 45, in chomp4
NameError: string

which is python's way of telling you that you
used a name that Python hasn't seen before.

(adding an "import string" will help)


More information about the Python-list mailing list