删除数组中相同元素

一、list去重,用set,不保留原顺序

ids=['a','a','d','d','t']
# ids=[1,2,3,2,1,3,4,1,3,6]
ids=list(set(ids))
print(ids)
['d', 't', 'a']

# wordlist=['a','a','d','d','t']
# newList=[]
# for n in wordlist:
#     if n not in newList:
#         newList.append(n)
# print(newList)
['a', 'd', 't']