Python字符串转十六进制进制互转

匿名 (未验证) 提交于 2019-12-02 22:54:36
def str_to_hex(s):     return ' '.join([hex(ord(c)).replace('0x', '') for c in s])  def hex_to_str(s):     return ''.join([chr(i) for i in [int(b, 16) for b in s.split(' ')]])  def str_to_bin(s):     return ' '.join([bin(ord(c)).replace('0b', '') for c in s])  def bin_to_str(s):     return ''.join([chr(i) for i in [int(b, 2) for b in s.split(' ')]])
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!