set(lstone) works fine in python 2.5.1 Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> lstone = [ 1, 2, 3, 3, 4, 5, 5, 6 ] >>> set(lstone) set([1, 2, 3, 4, 5, 6])
On 3/26/08, kellygreer1 <[EMAIL PROTECTED]> wrote: > > What is the best way to filter a Python list to its unique members? > I tried some method using Set but got some "unhashable" error. > > lstone = [ 1, 2, 3, 3, 4, 5, 5, 6 ] > # how do i reduce this to > lsttwo = [ 1, 2, 3, 4, 5, 6 ] > > Is there a page on this in the Python in a Nutshell or the Python > Cookbook? > Did I miss something? > > Kelly Greer > [EMAIL PROTECTED] > change nospam to yahoo > -- > http://mail.python.org/mailman/listinfo/python-list > -- Furkan Kuru
-- http://mail.python.org/mailman/listinfo/python-list