Skip to content

Instantly share code, notes, and snippets.

@lukassup
Created June 1, 2016 17:58
Show Gist options
  • Save lukassup/68358d298ead122a84dacecc0e156669 to your computer and use it in GitHub Desktop.
Save lukassup/68358d298ead122a84dacecc0e156669 to your computer and use it in GitHub Desktop.

Generate random hex strings in Python

import uuid
uuid.uuid4().hex
'705e54562bca4991910e53958bf24729'
import random
import string
"".join(random.sample(string.ascii_lowercase+string.digits, 20))
'0u2iepf3nlacbgdyzrw6'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment