targetstr = "abcgbuvg"
####如果顺序不重要####
#set() will create a set of unique letters in the string
#"".join() will join the letters back to a string in arbitrary order
"".join(set(targetstr))
####考虑顺序问题####
from collections import OrderedDict
"".join(OrderedDict.fromkeys(targetstr))