# 导入 os 模块
import os
try:
print('Hello')
# 定义清屏函数,根据操作系统类型执行不同的清屏命令
def clear_screen():
# 如果操作系统是 Windows,执行 'cls' 命令清屏;否则执行 'clear' 命令
os.system('cls' if os.name == 'nt' else 'clear')
# 调用清屏函数,清除控制台屏幕
clear_screen()
print('World')
except Exception as e:
print(f"程序执行过程中出现错误: {e}")
finally:
input("Press Enter to exit...")