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

匿名 (未验证) 提交于 2019-12-02 22:51:30
 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

  

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!