So I'm doing an MIT OCW assignment where I am creating a functional game of hangman. I got everything working. In IDLE, I have to hit F5 to run the code in the shell. I don't know any other way to run it, but that's not the big deal to me.
The main problem: the shell gets absolutely full of responses. It just keeps stacking up with more and more output. So, my question. Is it possible to put in a piece of code to clear the shell? Or do I just have to deal with it for now?
EDIT: To clarify: I need the prints for each cycle. Every time the user guesses a letter, it prints something like this:
2 guesses remaining
Possible answers: abdfghijkpquvwxyz
Guess a letter:g
That letter is not in the word!
_ o_ _ _ tr_
I just want to know if there is a way I can clear what is in the shell before the next 'cycle' is printed.
您可以关闭它,然后在要运行该程序或从终端运行它时仅打开一个新程序,并在退出外壳后使用use clear
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.