I've got a list of strings. There are some duplicates. I want a list
of only the unique entries in that list. So I do the following:

mylist = ['project1' , 'project2', 'project3', 'project4', 'project1']

d = {}

for item in mylist:
    d[item] = None

cleanedlist = d.keys()


But d.keys() seems to add '\n' to each entry in cleanedlist.

1. How can I easily strip out the newline characters from the elements
of cleanedlist?
2. Is there a better way to achieve my objective (ie. a list method
for generating the cleaned list?)
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to