Posted By

vyahhi on 11/20/10


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Desoxena


String to binary


 / Published in: Python
 

  1. binary_int = lambda i, c = (lambda i, c: i and (c(i >> 1, c) + str(i & 1)) or ''): c(i, c)
  2. binary_str = lambda s: ''.join([binary(ord(ch)) for ch in s])
  3.  
  4. print binary_str('hello world')

Report this snippet  

You need to login to post a comment.