简体   繁体   English

Mac 上 python 的 os.system('cls') 的替代方案

[英]Alternative for os.system('cls') for python on mac

I am trying to make a stopwatch where I use os to clear the terminal for the ticking numbers, but os.system('cls') does not work on idle or on mac.我正在尝试制作一个秒表,我使用 os 来清除终端中的滴答数字,但 os.system('cls') 在空闲或 Mac 上不起作用。 Are there any alternatives I can use?我可以使用任何替代方案吗? I usually use repl because I am doing this for class.我通常使用 repl,因为我正在为 class 执行此操作。

os.system('clear') is the alternative for macOS and repl, however on repl you could also import replit and then call replit.clear() to clear the terminal. os.system('clear')是 macOS 和 repl 的替代方案,但是在 repl 上,您也可以import replit然后调用replit.clear()来清除终端。

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

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