登录 or

python生成随机验证码

import random
def get_code():
source = list('0123456789')
for i in range(97,123):
source.append(chr(i))
print('',join(random.sample(source,4)))
def v_code():
code = ''
for i in range(5):
add = random.choice([random.randrange(10),chr(random.randrange(97,123))])
code += str(add)
print(code)

0 个评论

要回复文章请先登录注册