def str2bin(value, classic_mode=True):
 text = ''
 for character in value:
  if (text != ''):
   text += ' '
  byte = ord(character)
  text += byte2bin(byte, classic_mode)
 return text

def str2bin ( value , classic_mode = True ) : text = '' for character in value : if ( text != '' ) : text += ' ' byte = ord ( character ) text += byte2bin ( byte , classic_mode ) return text
convert binary string to binary numbers .