bitio-0.3.0
توضیحات
Input/output utilities of a bit-basis file
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | bitio-0.3.0 |
| نام | bitio |
| نسخه کتابخانه | 0.3.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Daiju Nakayama |
| ایمیل نویسنده | 42.daiju@gmail.com |
| آدرس صفحه اصلی | https://github.com/hinohi/bitio |
| آدرس اینترنتی | https://pypi.org/project/bitio/ |
| مجوز | - |
# bitio
Utilities to read or write files by bit or bits
## 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 the 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)
```
Another interface
```py
l = []
wrapper = ByteWrapper(l.append)
f = bit_wrap(wrapper, "w")
f.write_bits(0b110000101, 10)
print(l) # [b"a"]
f.close()
print(l) # [b"a", b"@"]
```
نحوه نصب
نصب پکیج whl bitio-0.3.0:
pip install bitio-0.3.0.whl
نصب پکیج tar.gz bitio-0.3.0:
pip install bitio-0.3.0.tar.gz