list iteration question

Fredrik Lundh effbot at telia.com
Wed Feb 16 16:40:14 EST 2000


David R. Favor <dfavor at austin.ibm.com> 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 "bzzt.py", line 52, in ?
  File "bzzt.py", 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)

</F>





More information about the Python-list mailing list