get unique values in string python code example

Example 1: python list with only unique values

my_list = list(set(my_list))

Example 2: find unique char in string python

In [1]: list(set('aaabcabccd'))
Out[1]: ['a', 'c', 'b', 'd']

Example 3: 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

Tags:

Java Example