Convert integer to fixed length binary string

casebash walkraft at
Thu Jun 11 05:28:16 EDT 2009


I know the bin function converts an int into a binary string.
Unfortunately, I need to know the length of the binary string when it
is being read in and len(bin(x)) depends on x. Is there any way to
limit it to 4 bytes?

Thanks for your assistance,


More information about the Python-list mailing list