首页 > 解决方案 > 如何冻结程序

问题描述

嗨,我想知道如何在 python 中冻结程序。

from time import *
from sys import *
caractère = ("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$%&'()*+,-./:;<=>?@[\]^_`{|}~").lower()
a = int(input("The number of character in the password: "))
print("The password is:")
for i in range(a):
    password = ""
    cara = choice(caractère)
    print(cara, end='')

最后我想看到密码,但我不能,因为程序会自动关闭。我们能做到吗?谢谢

标签: python

解决方案


您可以在程序末尾添加一条input()语句,以便在您单击任意键并按 Enter 时它会自行关闭。也可以添加time.sleep(N)N秒后自动关闭程序。


推荐阅读