Python 3 struct.pack() printing weird characters

后端 未结 2 1473
梦如初夏
梦如初夏 2021-01-13 18:06

I am testing struct module because I would like to send simple commands with parameters in bytes (char) and unsigned int to another application.

However I found some

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-13 18:21

    "\xNN" is just the way to represent a non-prinatble character ... it will give you the prinable character if it can

    print "\x0a" == "\n" == chr(10)

提交回复
热议问题