2019-03-17
阅读量:
481
python如何使用字符串常量
示例python如何使用字符串常量
# Importing random to generate
# random string sequence
import random
# Importing string library function
import string
def rand_pass(size):
# Takes random choices from
# ascii_letters and digits
generate_pass = ''.join([random.choice( string.ascii_uppercase +
string.ascii_lowercase +
string.digits)
for n in range(size)])
return generate_pass
# Driver Code
password = rand_pass(10)
print(password)
输出:
2R8gaoDKqn






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论