08 random
应用:随机生成验证码
import random
def get_random_code(length=6):
data = []
for i in range(length):
v = random.randint(65,90)
data.append(chr(v))
return ''.join(data)
code = get_random_code()
print(code)
import random # 导入一个模块
v = random.randint(起始,终止) # 得到一个随机数