码迷,mamicode.com
首页 > 编程语言 > 详细

python4位字典生成

时间:2015-02-05 13:32:59      阅读:529      评论:0      收藏:0      [点我收藏+]

标签:

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()

python4位字典生成

标签:

原文地址:http://www.cnblogs.com/i0ject/p/4274496.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!