Skip to content

Instantly share code, notes, and snippets.

@moonbingbing
Created August 23, 2012 10:39
Show Gist options
  • Save moonbingbing/3435381 to your computer and use it in GitHub Desktop.
Save moonbingbing/3435381 to your computer and use it in GitHub Desktop.
random string
#!/usr/bin/python
# -*- coding: utf-8 -*-
import random
def random_string(length):
str = ''
for i in range(length):
str += chr(random.randint(ord('#'),ord('~')))
return str
if __name__ == "__main__":
print random_string(16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment