office_list = []
print("Type in your office supplies.\nEnter 'DONE' to print out your list.\n--------------------\n")
while True:
list = input("> ")
if list == 'DONE':
break
office_list.append(list)
print("Here is your list\n--------------------\n")
for ls in office_list:
print(ls)
我一直在试图找到这个在线,但似乎有麻烦,试图找到正确的词汇我相信。在打印列表之前,如何让程序清除控制台清洁?
我想让程序做的事情很清楚我写了什么来制作列表然后打印列表。现在在程序中发生的事情是,当我输入单词“完成”时,它会在列表顶部输入文字并打印出来。
可能重复的[如何清除解释器控制台?](https://stackoverflow.com/questions/517970/how-to-clear-the-interpreter-console) – JakeD
也许最好是运行'clear && python foo.py' – slezica
@slezica我需要在程序运行时清除文本。不是当我尝试启动程序时。 –