python4位字典生成

f=open("dict.txt",'w+')
chars=[
'0','1','2','3','4','5','6','7','8','9',
]
base=len(chars) #62
end=len(chars)**4
for i in range(0,end):
n=i
ch0=chars[n%base]
n=n/base
ch1=chars[n%base]
n=n/base
ch2=chars[n%base]
n=n/base
ch3=chars[n%base]
print i,ch3,ch2,ch1,ch0
f.write(ch3+ch2+ch1+ch0+'\r\n')
f.close()

posted @ 2015-02-05 12:25  i0ject  阅读(592)  评论(0编辑  收藏  举报