/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
binary_int = lambda i, c = (lambda i, c: i and (c(i >> 1, c) + str(i & 1)) or ''): c(i, c) binary_str = lambda s: ''.join([binary(ord(ch)) for ch in s]) print binary_str('hello world')