How to enter decimal/binary numbers when creating byte objects in python?

Posted by Eric on Stack Overflow See other posts from Stack Overflow or by Eric
Published on 2010-04-10T18:19:32Z Indexed on 2010/04/10 18:23 UTC
Read the original article Hit count: 186

Filed under:

I'm using python 3.1.1.

I know that I can create byte objects using the byte literal in the form of b'...'. In these byte objects, each byte can be represented as a character(in ascii code if I'm not wrong) or as a hexadecimal/octal number. Hexadecimal and octal numbers can be entered using an escape of \x for hexadecimal numbers and just a \ for octal numbers.

However, there's no escape sequences for decimal or binary numbers. Is there any way to enter them into byte objects?

© Stack Overflow or respective owner

Related posts about python