Removing matching items from a list?
Christian Gollwitzer
auriocus at gmx.de
Sun Aug 4 02:52:51 EDT 2013
Hi Kevin,
Am 04.08.13 02:38, schrieb kevin4fong at gmail.com:
> Sorry for the repeated messages. I have no idea why I have such a
> long time delay. My messages didn't appear until just now after a few
> minutes (thought I was having some issues).
>
you are posting to newsgroups from the USENET. It is typical that your
posts need some time, and more time is needed for the message to show up
*for other people* - many people see your message only after an hour or
similar.
Concerning your question,
> Let's say there's 4 a's taken out. The list would show:
> ['a']
> But if there was also 4 j's in addition to the 4 a's, it would go:
> ['a', 'j']
well, when you take them out, as Steven has shown, you can also store
them in an additional list, like
takeouts.append(removedchar)
If you are only interested in the number, you could count the items in
the original list and subtract the number of items in you final list.
Christian
More information about the Python-list
mailing list