擅长:python、mysql、java
<p>看看这个答案</p>
<pre><code>#Imports
import string
import random
import time
digits = string.digits
letters = string.ascii_letters
punctuation =("!\"\<>@#£$%^&*")
PasswordCode = letters+punctuation+digits
PassLenInput = input("How long should the password be?")
PassLenInput = int(PassLenInput)
password = ""
for i in range(PassLenInput):
password += random.choice(PasswordCode)
print(password)
#Save Password
with open("password.txt", "w") as save_password:
save_password.write(password)
</code></pre>