成长带走的不只是时光,还带走了那些不害怕失去的勇气。谢谢那些怀疑我的人,给我成长的洗礼,让我更加孤独。
本文实例讲述了Python2随机数列生成器。分享给大家供大家参考,具体如下:
#filename:randNumber.py
import random
while True:
try:
row=int(raw_input('Enter the rows:'))
cols=int(raw_input('then Enter the cols:'))
minNum=int(raw_input('then Enter the minNumber:'))
maxNum=int(raw_input('then Enter the maxNumber:'))
r=0
while r<row:
line=''
c=0
while c<cols:
s=random.randint(minNum,maxNum)
line+=str(s)
line+=' '
c+=1
r+=1
print(line)
except ValueError as err:
print err
PS:这里再提供几款相关工具供大家参考使用:
在线随机生成个人信息数据工具:
http://tools.haodaima.com/aideddesign/rnd_userinfo
在线随机字符/随机密码生成工具:
http://tools.haodaima.com/aideddesign/rnd_password
在线随机数字/字符串生成工具:
http://tools.haodaima.com/aideddesign/suijishu
常用电话号码在线查询:
http://tools.haodaima.com/bianmin/pub_tel
希望本文所述对大家Python程序设计有所帮助。
本文Python2随机数列生成器简单实例到此结束。要铭记在心:每天都是最美好的日子。小编再次感谢大家对我们的支持!