考虑以下代码:
docker run -it --rm python:3.7.1-alpine3.8 \
python -c "import sys; sys.stdout.buffer.write( b'\x0a' )" | hexdump
打印内容:
0000000 0d 0a
0000002
因为sys.stdout.buffer
是一个二进制流,平台是Linux
(即,不是Windows
)(参见0A hex bug on writing to file?),所以我希望输出是纯0x0a
。你知道吗
在我看来,\n
->;\r\n
翻译实际上正在发生。
如何禁用它?你知道吗
原来这确实是码头工人的问题。见issue 2789。你知道吗
相关问题 更多 >
编程相关推荐