Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4049

Python • Re: boolean conversion problem

$
0
0
'b' is a string which is the result that comes back from BIN().

If you are trying to check the bit in the ASCII position of '5' as a character then you need a different approach.

If you are trying to check the bit value of integer as a binary then see this post https://docs.vultr.com/python/built-in/bin. In particular this example

Code:

number = 5formatted_binary = format(number, '08b')print(formatted_binary)

Statistics: Posted by DS256 — Thu Dec 05, 2024 9:38 pm



Viewing all articles
Browse latest Browse all 4049

Trending Articles