Advertisement
FranzVuttke

bin2char char2bin

Jan 16th, 2023 (edited)
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. # bin to char
  2. string = """01001001 01100110 00100000 01111001 01101111 01110101 00100000 01100011 01100001 01101110 00100000 01110010 01100101 01100001 0110010
  3.   ...: 0 00100000 01110100 01101000 01101001 01110011 00100000 01111001 01101111 01110101 00100000 01100001 01110010 01100101 00100000 01100001 001
  4.   ...: 00000 01100110 01110101 01100011 01101011 01100101 01100100 00100000 01101110 01100101 01110010 01100100"""
  5. "".join([chr(int(c,2)) for c in string.split(" ")])
  6.  
  7. # char to bin
  8. string = "0b1001110 0b1101111 0b1101111 0b1101111 0b101100 0b100000 0b1001001 0b100111 0b1101101 0b100000 0b1101110 0
  9.   ...: b1101111 0b1110100"
  10. " ".join([bin(ord(c)) for c in string])
  11.  
  12.  
  13.  
  14.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement