這個很(hěn)好用(yòng)
import random
import string
def generate_fun_password(length=12):
words = ["Sun", "Moon", "Star", "Cloud", "Wind", "Tree", "Sky"]
special_chars = "!@#$%^&*"
password = random.choice(words)
password += ''.join(random.choices(string.ascii_letters + string.digits, k=length - len(password) - 1))
password += random.choice(special_chars)
return ''.join(random.sample(password, len(password)))
print("Your fun password:", generate_fun_password())
這是示例圖: