import random
import datetime
zifu = [1,2,3,4,5,6,7,8,9,0,'a','b','c','d','e','f','g','h',
'i','j','k','l','m','n','o','p','q','r','s','t','u',
'v','w','x','y','z','!','@','#','~','`','%','^',
'&','*','(',')','-','_','+','=','{','}','[',']',';',
':',"'",'<',',','>','.','/','?','A','B','C','D','E','F','G','H',
'I','J','K','L','M','N','O','P','Q','R','S','T','U',
'V','W','X','Y','Z']
while True:
max_ = int(input("请输入密码长度(单位:字符)"))
start = datetime.datetime.now()
t = 0
while t != max_:
xuan = zifu[random.randint(1,90)]
t += 1
print(xuan,end = '')
print("\n")
end = datetime.datetime.now()
print(end-start)
同样是输入一个数,这串代码在IDLE中需要很久而且越来越慢,但在终端却只需要零点几秒,有没有大佬能解释一下为什么和IDLE的运行机制,谢谢了