Find duplicates in a list and count them ...

Paul.Scipione at aps.com Paul.Scipione at aps.com
Thu Mar 26 15:22:27 EDT 2009


Hello,

I'm a newbie to Python.  I have a list which contains integers (about 80,000).  I want to find a quick way to get the numbers that occur in the list more than once, and how many times that number is duplicated in the list.  I've done this right now by looping through the list, getting a number, querying the list to find out how many times the number exists, then writing it to a new list.  On this many records it takes a couple of minutes.  What I am looking for is something in python that can grab this info without looping through a list.

Thanks!

Paul J. Scipione
GIS Database Administrator
work: 602-371-7091
cell: 480-980-4721



Email Firewall made the following annotations

---------------------------------------------------------------------
--- NOTICE ---

This message is for the designated recipient only and may contain confidential, privileged or proprietary information.  If you have received it in error, please notify the sender immediately and delete the original and any copy or printout.  Unintended recipients are prohibited from making any other use of this e-mail.  Although we have taken reasonable precautions to ensure no viruses are present in this e-mail, we accept no liability for any loss or damage arising from the use of this e-mail or attachments, or for any delay or errors or omissions in the contents which result from e-mail transmission.

---------------------------------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090326/becc1b83/attachment.html>


More information about the Python-list mailing list