13 lines
305 B
Python
13 lines
305 B
Python
#!/usr/bin/env python3
|
|
|
|
import io
|
|
import sys
|
|
from time import sleep
|
|
|
|
# 将标准输出设置为无缓存模式
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, write_through=True)
|
|
|
|
if __name__ == "__main__":
|
|
# 之后的 print 都不再需要写 flush=True 了
|
|
print("这条消息会立即输出")
|