I am trying to find how to get unique letters in a given string.
Do we have any inbuilt method to get it?
My code:
strname='aavccbb'
strname.most_common()
Expected output:
abcv
I would have made use of set
but there is no guarantee of order.
CodePudding user response:
# Long form
strname='aavccbb'
lst = list(strname)
lst.sort()
print(set(lst))
# Short form
print(sorted(set(list(strname))))