random 实现6位随机验证码

import random
import time


def randoms():
    start_time = time.time()
    list_random = []
    for i in range(6):
        num = str(random.randint(0, 9))
        list_random.append(num)
    nums = ''.join(list_random)
    end_time = time.time()
    times = start_time - end_time
    return nums, times


print(randoms())

 

posted @ 2018-10-15 14:09  Lilinpei  阅读(324)  评论(0编辑  收藏  举报