How to Convert a string into binary

Felipe Almeida Lessa felipe.lessa at gmail.com
Sat Apr 15 19:10:22 EDT 2006


Em Sáb, 2006-04-15 às 18:09 -0400, Terry Reedy escreveu:
> # given string s
> binchars = []
> for c in s: binchars.append(a2b[ord(c)])

Faster:

binchars = [a2b[ord(c)] for c in s]

-- 
Felipe.




More information about the Python-list mailing list