2009/7/22 superpollo <u...@example.net>

> hello clp.
>
> i can insert a hex value for a character literal in a string:
>
> >>> stuff = "\x45"
> >>> print stuff
> E
> >>>
>
> can i do something like the above, but using a *binary* number? (e.g.
> 00101101 instead of 45) ?


(Python 3)

 >>> bin(45)
'0b101101'
>>> int(_, 2)
45

-- 
Pablo Martí
http://www.linkedin.com/in/pmarti || http://www.warp.es
python -c "print '706d6172746940776172702e6573'.decode('hex')"
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to