Hi everyone,
i would like to know if there is in python a way of converting a number into its 8bit long binary representation? in fact i know that the function bin() does that but for small numbers not in 8bit representation.
ex:
bin(56) returns 0b111000 (which is a 6bit representation)
i would like to have this:
bin(56) -> 0b00111000 (8bit representation)
or bin(2) -> 0b00000010
is that possible in python or do i have to write my own function for this?
Thanks
Thierry
i would like to know if there is in python a way of converting a number into its 8bit long binary representation? in fact i know that the function bin() does that but for small numbers not in 8bit representation.
ex:
bin(56) returns 0b111000 (which is a 6bit representation)
i would like to have this:
bin(56) -> 0b00111000 (8bit representation)
or bin(2) -> 0b00000010
is that possible in python or do i have to write my own function for this?
Thanks
Thierry