Guest User

Untitled

a guest
Jun 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. # function to create random user IDs
  2. import uuid
  3.  
  4. user_ids = []
  5. AGENCY = 'MSWGCA'
  6.  
  7. def createid():
  8. x = uuid.uuid4()
  9. y = list(str(x))
  10.  
  11. id = ''
  12. for i in range(8):
  13. id = id + y[i]
  14.  
  15. new_id = AGENCY + '/' + id
  16.  
  17. if new_id not in user_ids:
  18. user_ids.append(new_id)
  19. print(new_id)
  20. else:
  21. createid()
  22.  
  23. createid()
Add Comment
Please, Sign In to add comment