以下を試して見てください。
python
1table_hb ={'0': '0000', '1': '0001', '2': '0010', '3': '0011', '4': '0100', '5': '0101', '6': '0110', '7': '0111', '8': '1000', '9': '1001', 'a': '1010', 'b': '1011', 'c': '1100', 'd': '1101', 'e': '1110', 'f': '1111'}
2
3def conv_hb(h):
4 return ''.join([table_hb[c] for c in h])
実行結果
python
1>>> print(conv_hb(hex_data))
21111111100000000
以下は2.4では動かないようです。
Python2系は試していませんが、Python3系なら、
python
1>>> print(bin(int(hex_data, 16))[2:])
21111111100000000
Python2.4で動かなければ教えてください。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2021/11/16 09:20
2021/11/17 04:21