unique id python code example

Example 1: python generate uid

# 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())

Example 2: python get unique id for object

# Get an Id for object:
print(id(2))
140711177190496

print(id("Hi"))
2568748444272

#Why is it so important? If you want to decode something, 
#you can encode it easily by checking with the if statement

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