Conversion of the binary string string Python

def encode(s):
    return ' '.join([bin(ord(c)).replace('0b', '') for c in s])
 
def decode(s):
    return ''.join([chr(i) for i in [int(b, 2) for b in s.split(' ')]])

  

Guess you like

Origin www.cnblogs.com/clear93/p/11097379.html
Recommended