Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def hex2binstr(bstr):
- t = {
- "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',
- }
- o = ""
- for b in bstr:
- o = o + t[b]
- return o
- print(hex2binstr("d4f3"))
- print(hex2binstr("caf3"))
Add Comment
Please, Sign In to add comment