当我运行以下代码并打开名为pwd.txt的文件时,它在所有 100 行中显示相同的密码
import string
from random import *
characters = string.ascii_letters + string.digits
password = "".join(choice(characters) for x in range(randint(8,16)))
with open('pwd.txt', 'w') as f:
for _ in range(100):
f.write(password + '\n')