[Tutor] For statement
Øyvind Dale Spørck
oyvind.sporck at eniro.no
Thu Mar 11 12:31:59 EST 2004
I have a list:
a= ['golden,','poodle,','flat,','retriever,']
I would like to remove the , after the word, with a for statement. However, the result doesn't end up as I like. I end up removing one of the items at the time or getting a "TypeError: list indices must be integers" error.
I have tried tons of different versions such as:
>>> for x in a:
... a[:] = a[:][:-1]
... print a
But it doesn't work.
How would I do it? Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040311/79d2e864/attachment.html
More information about the Tutor
mailing list