Python 中 sys.stdout 默认是 text mode
切换到 binary mode:
sys.stdout = sys.stdout.buffer
切换回来:
sys.stdout = sys.__stdout__
本文介绍了Python中如何将sys.stdout从默认的textmode切换到binarymode,以及如何再将其切换回原来的模式。通过简单的代码示例展示了这一过程。
Python 中 sys.stdout 默认是 text mode
切换到 binary mode:
sys.stdout = sys.stdout.buffer
切换回来:
sys.stdout = sys.__stdout__
362
630
6448
2万+

被折叠的 条评论
为什么被折叠?