将Bytes写入txt文件import sys # sys.stdout.write(b'Hello\n') sys.stdout.buffer.write(b'Hello\n') 转载于:https://www.cnblogs.com/4thing/p/5705508.html