python code to remove duplicates from string code example
Example 1: Python program to remove duplicate characters of a given string.
>>> foo = 'mppmt'
>>> ''.join(sorted(set(foo), key=foo.index))
'mpt'
Example 2: remove duplicates function python
def remove_dupiclates(list_):
new_list = []
for a in list_:
if a not in new_list:
new_list.append(a)
return new_list