码迷,mamicode.com
首页 > 编程语言 > 详细

【 python】输出随机的字符或数字

时间:2018-08-29 14:27:52      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:字符   and   rand   choice   print   col   nbsp   python   pre   

 

随机输出0-9的数字

from random import choice
x = choice([0,1,2,3,4,5,6,7,8,9])
print x

输出结果

#python first.py
2

#python first.py
3

#python first.py
2

..............

 

【 python】输出随机的字符或数字

标签:字符   and   rand   choice   print   col   nbsp   python   pre   

原文地址:https://www.cnblogs.com/carriezhangyan/p/9552404.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!