如何成功地将变量更改为> 4?

时间:2015-07-04 07:37:42

标签: python passwords

我是python的新手,刚刚学习基础知识。我的问题是为什么我能够将每个密码变量的部件数量更改为任何数字4或更少,并且程序运行正常,但是当我尝试将4更改为7时,我希望程序不会产生任何结果。

# Import dependancies
import itertools

# Create array with known parts of the password
parts = ['foo', 'FOO', 'Foo', 'bar', 'BAR', 'Bar', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '!', '@', '#', '$', '%', '^', '&', '*']

# Number of parts per password
number = 4

# Build a list of combinations of knows parts with number of parts
permutations = list(itertools.permutations(parts, number))

# Print list
for (i, permutation) in enumerate(permutations):
  print ''.join(permutation)

0 个答案:

没有答案