【问题标题】:How do you clear the console mid program in python?如何清除python中的控制台中间程序?
【发布时间】:2022-06-14 03:06:19
【问题描述】:

最近我一直在编写一个不错的控制台 RPG 代码,以尝试使用我在过去几个月中学到的一些新的 Python 技能。但有些事情困扰着我……

这真是太有趣了!但真正困扰我的一件事是我不知道如何清除终端程序中的程序,我搜索的所有内容都没有显示我需要的结果。为了清除到下一个屏幕,我通常只使用我制作的这个名为“清除”的功能。代码如下:

# Clear Function
def clear():
    print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")

# Example of what it would look like in game.
print("Oh no! Theres a Dragon here!")
input()
print("What are we going to do???")
input()
clear()
print("You enter a fight with the dragon!")
input()

如果代码不好,我深表歉意,无论如何我才刚刚开始......但我真的在寻找一些答案。

【问题讨论】:

标签: python


猜你喜欢
  • 1970-01-01
  • 2022-06-25
  • 2021-12-10
  • 2011-02-28
相关资源
最近更新 更多