本文實例講述了Python2隨機數列生成器。分享給大家供大家參考,具體如下:
#filename:randNumber.pyimport randomwhile 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 errPS:這里再提供幾款相關工具供大家參考使用:
在線隨機生成個人信息數據工具:
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相關內容感興趣的讀者可查看本站專題:《Python數學運算技巧總結》、《Python字符串操作技巧匯總》、《Python編碼操作技巧總結》、《Python數據結構與算法教程》、《Python函數使用技巧總結》、《Python入門與進階經典教程》及《Python文件與目錄操作技巧匯總》
希望本文所述對大家Python程序設計有所幫助。
新聞熱點
疑難解答