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())