Skip to content

Instantly share code, notes, and snippets.

@tun
Created September 13, 2013 05:10
Show Gist options
  • Save tun/6546958 to your computer and use it in GitHub Desktop.
Save tun/6546958 to your computer and use it in GitHub Desktop.
Generates random string
# -*- coding: utf-8 -*-
import string
import random
def random_string(size=6):
chars = (string.ascii_uppercase + string.ascii_lowercase + string.digits)
return ''.join(random.choice(chars) for x in range(size))
if __name__ == '__main__':
print random_string()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment