而在Python 2.7中循环密码生成器

时间:2017-02-06 17:36:55

标签: python python-2.7 while-loop

根据我最近在这里发布的一个问题,我设法为我正在进行的任务创建密码生成器。我的密码生成器代码如下:

from random import shuffle
data = open('randomwords.txt', 'r').read().split()
shuffle(data)

# Creates password from Gadsby text file
password = ''
for x in data[:3]:
    password += x

print password.replace('o', '0')

每次运行程序时都会创建一个密码。我需要程序在while循环中运行,所以每次我想尝试新密码时都不必重新启动程序。

此外,我希望能够将密码输出到另一个文本文件中,从而为我创建一个词汇表供我在此作业中使用。

0 个答案:

没有答案