Created
August 23, 2012 10:39
-
-
Save moonbingbing/3435381 to your computer and use it in GitHub Desktop.
random string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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