python - 如何冻结程序
问题描述
嗨,我想知道如何在 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='')
最后我想看到密码,但我不能,因为程序会自动关闭。我们能做到吗?谢谢
解决方案
您可以在程序末尾添加一条input()
语句,以便在您单击任意键并按 Enter 时它会自行关闭。也可以添加time.sleep(N)
N秒后自动关闭程序。
推荐阅读
- javascript - 如何修复触摸事件侦听器?
- javascript - 如何加快对服务器的请求?(PUGREST.超时)
- .net - Vb .Net 1.1 分组数组 - 键/值对
- python - 我正在制作一个时钟,但我的代码中的分钟没有更新。我怎样才能解决这个问题?
- angular - 如何在 Angular 模块中使用接口和 observable 从 HTTP GET 请求的结果中使用 *ngFor 显示结果?
- android - 当应用程序在后台时,意图服务在 android 9 上正常运行
- php - 为什么 PHP 在表格中打印奇怪的结果?
- amazon-web-services - 从 AWS Pipeline EC2 实例连接到 RDS
- sql - 如何确保postgresql表中只有一列不为空
- php - PHP无序关联数组到CSV行匹配标题到键,根据需要创建新标题