简体   繁体   English

如何在shell内重新运行一个在Python IDLE的程序?

[英]How to rerun a program in Python IDLE within the shell?

How do i rerun a program in IDLE shell without having to go back to the saved code and pressing F5 over and over every time I want to execute it?我如何在 IDLE shell 中重新运行程序,而不必 go 回到保存的代码并在每次我想执行它时一遍又一遍地按 F5? is there any shortcuts or hotkeys that could be pressed while in the shell?在 shell 中是否有可以按下的快捷键或热键?

for example i have a simple program that prints a typed message:例如,我有一个简单的程序可以打印键入的消息:

message = input('Enter message: ')
print(message)

once i run this simple program, i give the input, the program prints input and the program ends.一旦我运行这个简单的程序,我就提供输入,程序打印输入,然后程序结束。 Now, say i want to give a different input, i'd have to leave the shell and go back to the saved code and press F5 again.现在,假设我想提供不同的输入,我必须将 shell 和 go 保留回保存的代码并再次按 F5。 but if there was a hotkey that could be pressed while in the shell that would rerun the program, that would be awesome.但是如果在 shell 中有一个可以重新运行程序的热键,那就太棒了。

maybe add input() in the end of your code so you can see the results in console before it disappear也许在你的代码末尾添加input()这样你就可以在它消失之前在控制台中看到结果

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM