您的位置:首页 > 编程语言 > Python开发

[ Python - 5 ] 通过random模块生成随机字符串

2017-06-25 07:16 507 查看
import random
checkcode = ''
for i in range(4):
if i == random.randint(0,3):
current = chr(random.randrange(65,90))
checkcode += str(current)
else:
checkcode += str(i)

print(checkcode)


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: