Printing Null Character (“\x00”) in Python vs C

后端 未结 1 522
被撕碎了的回忆
被撕碎了的回忆 2021-01-22 09:01

When I code and run the statement:

   print \"\\x00\\x00\\x00\"

in Python it outputs three blank spaces followed by a newline. But in C, when I

相关标签:
1条回答
  • 2021-01-22 09:50

    So why in Python are NULL bytes treated as spaces?

    It's not. Your terminal/console is treating them like spaces. C just happens to stop at the first NUL, whereas Python outputs them. Try writing three NULs to stdout instead.

    0 讨论(0)
提交回复
热议问题