-
#!/usr/bin/env python
-
# -*- coding:utf-8 -*-
-
-
import random
-
import string
-
-
def random_str(size):
-
all_char = string.letters + string.digits + string.punctuation
-
rchars = [random.choice(all_char) for i in range(size)]
-
rstr = "".join(rchars)
-
return rstr
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26250550/viewspace-2131899/
,如需转载,请注明出处,否则将追究法律责任。