当前位置: 移动技术网 > IT编程>脚本编程>Python > Python学习第七天——随机码生成

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

2018年04月25日  | 移动技术网IT编程  | 我要评论

强强三人组,张家口热线,武冈电视台

 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

  

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网