osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bitstream -- Binary Data for Humans (Posting On Python-List Prohibited)


On 3/6/2018 3:58 AM, S?bastien Boisg?rault wrote:
> Hi Lawrence,
> 
> Le mardi 6 mars 2018 01:20:36 UTC+1, Lawrence D?Oliveiro a ?crit?:
>> On Tuesday, March 6, 2018 at 8:06:00 AM UTC+13, S?bastien Boisg?rault wrote:
>>> I have released bitstream, a Python library to manage binary data
>>> (at the byte or bit level), hopefully without the pain that this kind
>>> of thing usually entails :)
>>
>>>     byte_index = offset / 8
>>
>> This will return a float.

byte_index // 8
will give you the int index directly in both late 2.x and 3.x.

-- 
Terry Jan Redey