25 lines
576 B
Python
25 lines
576 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
测试print输出是否正常
|
|
"""
|
|
import sys
|
|
import time
|
|
|
|
def test_print_output():
|
|
print("=== 测试print输出 ===")
|
|
print(f"Python版本: {sys.version}")
|
|
print(f"运行时间: {time.strftime('%Y-%m-%d %H:%M:%S')}")
|
|
|
|
# 测试强制刷新
|
|
print("强制刷新输出...", flush=True)
|
|
sys.stdout.flush()
|
|
|
|
# 测试延迟输出
|
|
for i in range(3):
|
|
print(f"延迟输出 {i+1}/3", flush=True)
|
|
time.sleep(1)
|
|
|
|
print("print输出测试完成!")
|
|
|
|
if __name__ == "__main__":
|
|
test_print_output() |