无序字符串生成,字符串生成,Interactive
无序字符串生成,字符串生成,Interactive
Interactive Window.py
import randomdef generateStr(N = 4,up = 1 ,lo = 1,nm = 1,sp = 1): #init data rstr,genStr,ist,sec,thi,fou,sR,sr,si,ss = 10*[''] uSum = up + lo + nm + sp # exception handle if uSum < 1 or uSum > N : print('Error Combine Input : ') return 0 # exception handle if up == 1 : sR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ist = random.choice(list(sR)) if lo == 1 : sr = 'abcdefghijklmnopqrstuvwxyz' sec = random.choice(list(sr)) if nm == 1 : si = '0123456789' thi = random.choice(list(si)) if sp == 1 : ss = '_.@#%^&*`\/' fou = random.choice(list(ss)) astr = sR + sr + si + ss for i in range(0,N-uSum): rstr = rstr + random.choice(list(astr)) restr = rstr + ist + sec + thi + fou #random the string restr = list(restr) random.shuffle(restr) #list convert to string for i in restr: genStr += i return genStrprint(generateStr(100,1,1,1,0))
相关内容
- python 中messagebox使用 做中断调试不错,pythonmessagebox,[
- S60手机屏幕截图,s60屏幕截图,[Python]代码im
- 封装subprocess来执行命令,subprocess执行命令,comand.py#!/
- Python的logging模块封装,pythonlogging模块,log.py#!/usr
- python获得本地计算机的名字,python获得计算机,import s
- Python 获取服务器信息,python获取服务器,sUrl = '<a h
- python 自动重启本程序,python重启程序,[Python]代码#!
- 仿内置用法 按key分组成嵌套字典,key嵌套,[Python]代码
- python 可分组字典 对象按属性分组成字典,python字典,
- 多线程找当前目录(包括子目录)占用空间前25位的文件,
评论关闭