密码锁随机生成有时候也很实用,这里分享一个源码:
import sys
import random
import string
Max_Count=50
for i in range(1,int(Max_Count)):
string1='insert into temp values('
zone_id=101
num_id=int(i)
test_code=str('test')+str(int(Max_Count)*1000+i)
passwd=str(random.random())
passwd1=passwd.replace('.','xdw')
passwd2=str(random.uniform(1,99))
passwd3=passwd2.replace('.','ibox')
pwd=passwd1+passwd3
while(len(pwd))!=32:
passwd=str(random.random())
passwd1=passwd.replace('.','yiq')
passwd2=str(random.uniform(1,99))
passwd3=passwd2.replace('.','acid')
pwd=passwd1+passwd3
test_name='test%d'%i
test_ip=2087917712
test_mac='00-00-00-00-00-00'
test_state='1);'
print string1,num_id,str(','),zone_id,str(','),repr(test_code),str(','),repr(pwd),str(','),repr(test_name),str(','),test_ip,str(','),repr(test_mac),str(','),test_state
print "commit;"