Write bits in file

Tim Roberts timr at probo.com
Tue May 20 00:14:04 EDT 2008


Monica Leko <monica.leko at gmail.com> wrote:
>
>I have a specific format and I need binary representation.  Does
>Python have some built-in function which will, for instance, represent
>number 15 in exactly 10 bits?

For the record, I'd like to point out that even C cannot do this.  You need
to use shifting and masking to produce a stream of 8-bit bytes, or to
extract your values from a stream of 8-bit bytes.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list