python 字符串 hex 互转

简介: python 字符串 hex 互转


##hex转字符串
a = '61626364656667'
a_bytes = bytes.fromhex(a)
print("hex to string:",a_bytes.decode())
##字符串转hex
b = b'HelloWorld'
b_bytes = bytes.hex(b)
print("string to hex:",b_bytes)
目录
相关文章
|
4天前
|
索引 Python
python字符串(str)
【5月更文挑战第8天】
10 3
|
4天前
|
Python
【Python操作基础】——字符串
【Python操作基础】——字符串
|
2天前
|
索引 Python Go
【python学习】字符串详解,面试必问公司的问题
【python学习】字符串详解,面试必问公司的问题
|
4天前
|
Python
Python注意字符串和字节字面量
【5月更文挑战第7天】Python注意字符串和字节字面量
16 4
|
4天前
|
Python
Python字符串和字节不要混淆str.format()和bytes.format()
【5月更文挑战第6天】Python字符串和字节不要混淆str.format()和bytes.format()
8 1
|
4天前
|
Python
Python字符串和字节使用正确的编码/解码
【5月更文挑战第6天】Python字符串和字节使用正确的编码/解码
7 2
|
4天前
|
存储 Python
python字符串和字节明确数据类型
【5月更文挑战第6天】python字符串和字节明确数据类型
10 2
|
4天前
|
Python
Python避免在字符串和字节之间混淆
【5月更文挑战第5天】Python避免在字符串和字节之间混淆
17 3
|
4天前
|
数据安全/隐私保护 开发者 Python
【Python 基础】检查字符串是否只包含数字和字母?
【5月更文挑战第8天】【Python 基础】检查字符串是否只包含数字和字母?
|
4天前
|
Python
【Python 基础】如何将一个字符串转化为全大写和全小写?
【5月更文挑战第8天】【Python 基础】如何将一个字符串转化为全大写和全小写?