how to find unique values in a string in python code example
Example 1: count unique values in python
aa="XXYYYSBAA"
bb=dict(zip(list(aa),[list(aa).count(i) for i in list(aa)]))
print(bb)
# output:
# {'X': 2, 'Y': 3, 'S': 1, 'B': 1, 'A': 2}
Example 2: generate unique id from given string python
# Python3 code to generate the
# random id using uuid1()
import uuid
# Printing random id using uuid1()
print ("The random id using uuid1() is : ",end="")
print (uuid.uuid1())
# Output
# The random id using uuid1() is : 67460e74-02e3-11e8-b443-00163e990bdb