python十六进制字符串中0x和\ x的含义是什么?

The*_*eer 16 python numpy

我正在做一些二进制操作,通常显示为十六进制.我已经看到了0x\x前缀.

在哪种情况下使用?

Joh*_*ooy 31

0x用于文字数字."\x"在字符串中用于表示字符

>>> 0x41
65
>>> "\x41"
'A'

>>> "\x01" # a non printable character
'\x01'
Run Code Online (Sandbox Code Playgroud)