python十六进制字符串
To assign a hexadecimal value in the string so that it can be printed as a string, we use \x that is known as Escape sequence”, it represents that given value is the hexadecimal value.
为了在字符串中分配一个十六进制值以便可以将其打印为字符串,我们使用\ x ,即“转义序列”,它表示给定值是十六进制值。
Example:
例:
Input:
str = "\x41\x42\x43\x44"
Output:
str = "ABCD"
Input:
str = "This is \x49\x6E\x63\x6C\x75\x64\x65\x48\x65\x6C\x70"
Output:
str = "This is IncludeHelp"
Program:
程序:
# python program to assign hexadecimal values
# to the string
# declare and assign strings
str1 = "\x41\x42\x43\x44"
str2 = "This is \x49\x6E