文字列⇔バイナリ変換
文字列→バイナリ
バイナリ→文字列
>>>chars = list(map(hex, map(ord, "hello"))) >>>chars ['0x68', '0x65', '0x6c', '0x6c', '0x6f'] >>>result = '' >>>for i in chars: ... result += chr(int(i, 16)) ... >>>result 'hello'
>>>chars = list(map(hex, map(ord, "hello"))) >>>chars ['0x68', '0x65', '0x6c', '0x6c', '0x6f'] >>>result = '' >>>for i in chars: ... result += chr(int(i, 16)) ... >>>result 'hello'