Weight to a relatively high frequency strings, and lists recent interview
pstr = 'abcadcf'
# deduplication string
# 1, using the set - is not maintained in the original sequence
# 2, using a dictionary - did not keep the original order
print({}.fromkeys(pstr).keys())
# 3, using a loop through method - the code is simple enough, not high-end
a = []
for i in range(len(pstr)):
if pstr[i] not in a:
a.append(pstr[i])
print(a)
# List deduplication
# 1, using the set method
# 2, use the dictionary
print(list({}.fromkeys(plist).keys()))
# 3, loop through Law
plist1 = []
for i in plist:
if i not in plist1:
plist1.append(i)
print(plist1)
# 4, according to the index ordering again
b = list(set(plist))
b.sort(key=plist.index)
print('sds:',b)