Hendrik van Rooyen wrote:
On Wednesday 22 July 2009 12:03:44 superpollo wrote:
can i do something like the above, but using a *binary* number? (e.g.
00101101 instead of 45) ?
00101101 is not hex 45.
hex 45 is 01000101
whoopsie daisie!
chr(int('01000101',2))
'E'
much obliged.
by
On Wednesday 22 July 2009 12:03:44 superpollo wrote:
> can i do something like the above, but using a *binary* number? (e.g.
> 00101101 instead of 45) ?
00101101 is not hex 45.
hex 45 is 01000101
>>> chr(int('01000101',2))
'E'
>>>
- Hendrik
--
http://mail.python.org/mailman/listinfo/python-
superpollo wrote:
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) ?
Language Ref 2.4. Literals
--
http://mail.python.org/mailma
superpollo wrote:
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) ?
bye
There's no way to get a binary value directly into a lit
superpollo wrote:
> 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) ?
There are binary number literals since 2.6 and there is th
2009/7/22 superpollo
> 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'
>>> in
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) ?
bye
--
http://mail.python.org/mailman/listinfo/python-list