Skip to content

Instantly share code, notes, and snippets.

@fumingshih
Created February 14, 2012 05:22
Show Gist options
  • Save fumingshih/1823847 to your computer and use it in GitHub Desktop.
Save fumingshih/1823847 to your computer and use it in GitHub Desktop.
generating id/passwd
import string
from random import sample, choice
chars = string.letters + string.digits
length = 8
''.join(sample(chars,length)) # way 1
''.join([choice(chars) for i in range(length)]) # way 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment