Python2随机数列生成器简单实例
作者:linzj 时间:2021-11-18 08:12:37
本文实例讲述了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.jb51.net/aideddesign/rnd_userinfo
在线随机字符/随机密码生成工具:
http://tools.jb51.net/aideddesign/rnd_password
在线随机数字/字符串生成工具:
http://tools.jb51.net/aideddesign/suijishu
常用电话号码在线查询:
http://tools.jb51.net/bianmin/pub_tel
希望本文所述对大家Python程序设计有所帮助。
来源:http://www.cnblogs.com/linzhenjie/archive/2012/08/21/2650031.html
标签:Python,随机数
0
投稿
猜你喜欢
Python之lxml安装失败的解决
2023-11-27 04:34:22
详解Python中常用的图片处理函数的使用
2021-05-05 18:30:32
Python实现七大查找算法的示例代码
2021-05-28 07:33:35
ASP实现上传图片到数据库
2007-09-21 12:59:00
Python手写回归树的实现
2021-08-26 23:03:56
Python编程实现二叉树及七种遍历方法详解
2022-10-31 13:28:28
asp连接mssql2005的代码
2011-03-29 11:11:00
怎么让按钮更容易被点击
2007-08-22 09:07:00
用Python写漏洞验证脚本的代码
2023-09-04 05:38:36
原创一个AJAX类
2008-07-24 13:29:00
使用Pandas将inf, nan转化成特定的值
2023-04-15 23:36:33
Python嵌套函数,作用域与偏函数用法实例分析
2022-12-03 08:46:15
Python中关于浮点数的冷知识
2023-11-13 14:01:57
python按列索引提取文件夹内所有excel指定列汇总(示例代码)
2021-11-08 09:46:50
利用pip安装python第三方库的4种方法
2023-11-16 08:16:51
eWebEditor不支持IE,IE8,IE7,火狐,遨游的解决方法
2011-06-06 07:57:00
Python3实现的回文数判断及罗马数字转整数算法示例
2023-07-07 05:10:06
用asp程序读取网站的alexa世界排名
2008-11-23 20:43:00
python 爬取华为应用市场评论
2023-08-31 23:18:32
下拉列表两级连动的新方法(二)
2009-06-04 18:22:00