autoopen-0.1.0
توضیحات
Automatically compress or decompress files on open by filename.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | autoopen-0.1.0 |
| نام | autoopen |
| نسخه کتابخانه | 0.1.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Thorsten Vitt |
| ایمیل نویسنده | tv@thorstenvitt.de |
| آدرس صفحه اصلی | https://github.com/thvitt/autoopen |
| آدرس اینترنتی | https://pypi.org/project/autoopen/ |
| مجوز | MIT |
# autoopen
_autoopen_ is a small drop-in replacement for the most common use cases of Python’s built-in open() function that will automatically handle compressed files based on the filename.
## Usage
For example:
```python
from autoopen import autoopen
filename = "example.txt.xz"
with autoopen(filename, "rt", encoding="utf-8") as file:
contents = file.read()
```
`autoopen` will check the given filename’s last suffix. If it indicates one of the supported compressors, the corresponding compressor or decompressor will be used, otherwise it falls back to built-in `open`.
Support for .gz, .bz2, .xz, .lzma, and .zst/.zstd is built-in (the latter requires the [python-zstandard](https://pypi.org/project/zstandard/) package). The special filename `-` indicates reading from stdin or writing to stdout.
نیازمندی
| مقدار | نام |
|---|---|
| >=0.17.0,<0.18.0) | zstandard |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.9,<4.0 | Python |
نحوه نصب
نصب پکیج whl autoopen-0.1.0:
pip install autoopen-0.1.0.whl
نصب پکیج tar.gz autoopen-0.1.0:
pip install autoopen-0.1.0.tar.gz