Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Input/output utirites of a bit-basis file

Project description

# bitio

Input/output utirites of bit basis file

## How to use

```py
from bitio import bit_open

f = bit_open(file_name, "r")
x = f.read() # return 1 or 0
x = f.read_bits(count) # return int

f = bit_open(file_name, "w")
f.write(bit) # write 1 if bit else 0
f.write_bits(bits, count) # write 'count bits'
f.close()
```

These are same

```py
f.write_bits(bits, count)

for i in range(count-1, -1, -1):
if bits & (1 << i):
f.write(1)
else:
f.write(0)
```

othe interface

```py
l = []
wrapper = ByteWrapper(l.append)
f = bit_wrap(wrapper, "w")
f.write_bits(0b110000101, 10)
print l # ["a"]
f.close()
print l # ["a", "@"]
```

Project details


Release history Release notifications

This version
History Node

0.2

History Node

0.1.1

History Node

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
bitio-0.2.tar.gz (2.1 kB) Copy SHA256 hash SHA256 Source None May 1, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page