1. 程式人生 > >Python之簡單驗證碼實現

Python之簡單驗證碼實現

num turn str randint print ice ret int 驗證碼

def v_code():
ret = ‘‘
for i in range(5):
num = random.randint(0,9)
alf = chr(random.randint(65,122))
s = str(random.choice([num,alf]))
ret += s
return ret

print(v_code())

Python之簡單驗證碼實現