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)
```
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)
```
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bitio-0.1.1.tar.gz
(1.7 kB
view details)
File details
Details for the file bitio-0.1.1.tar.gz
.
File metadata
- Download URL: bitio-0.1.1.tar.gz
- Upload date:
- Size: 1.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bdb250fe7d09c9c8332525fa5b0beee206331af2c79291d669a877ea39e3a9e |
|
MD5 | 063b6ae57f498d185ab7029cce177db0 |
|
BLAKE2b-256 | 8ccb35a867dfd77ad9cef8cdfb1a975722703928f3203d2224712a71f787c13b |