欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Python学习第七天——随机码生成

程序员文章站 2022-10-06 23:44:42
1 #coding=utf-8 2 #Version:python 3.6.0 3 #Tools:Pycharm 2017.3.2 4 _date_ = '2018/4/24/024 15:11' 5 6 7 import random 8 9 check_code = '' 10 for i in ......
Python学习第七天——随机码生成
 1 #coding=utf-8
 2 #Version:python 3.6.0
 3 #Tools:Pycharm 2017.3.2
 4 _date_ = '2018/4/24/024 15:11'
 5 
 6 
 7 import random
 8 
 9 check_code = ''
10 for i in range(6):
11     current = random.randint(1,2)
12     if current == 1:
13         current = chr(random.randint(65,90))
14     else:
15         current = random.randint(0,9)
16     check_code += str(current)
17 print(check_code)
View Code
E:\ProgramData\Anaconda3\python.exe D:/Python_proc/s14/week5/day2/random_test.py
Q69R28

Process finished with exit code 0