[Tutor] Filtering out unique list elements

Spyros Charonis s.charonis at gmail.com
Wed May 4 00:20:17 CEST 2011


Dear All,

I have built a list with multiple occurrences of a string after some text
processing that goes something like this:

[cat, dog, cat, cat, cat, dog, dog, tree, tree, tree, bird, bird, woods,
woods]

I am wondering how to truncate this list so that I only print out the unique
elements, i.e. the same list but with one occurrence per element:

[cat, dog, tree, bird, woods]

Any help much appreciated!

Regards,
Spyros
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110503/334c331c/attachment.html>


More information about the Tutor mailing list