「python入門」テキストファイルにパスワードを生成するコード

pythonコード
#!/usr/bin/python
import string
letters = string.letters + string.digits + string.punctuation
length = len(letters)
fwrite = open(“/tmp/generatepwd.txt","wt")
fread = open(“/tmp/generatepwd.txt","r")
for num in xrange(8):
for times in xrange(length**num):
line=fread.read(num+1).rstrip()
for letter in letters:
fwrite.write(line + letter + “\n")
fwrite.flush()
fwrite.close()
fread.close()

Python

Posted by arkgame