readtail
Simple Description
- A simplest generator function written in pure python
- Seek from the tail of the file
Install
pip install tailread
Useage
import tailread as tail
# consuming tails one by one
lines = tail.readlines('access.log')
# take tail of one line
line = next(lines)
print(line)
# b'line 10/r/n'
# next...
line = next(lines)
print(line)
# b'line 9/r/n'
# When passing a fileobject, The file must be opened in bytes mode.
with open('access.log', 'rb'): as fp:
for line in tail.readlines(fp):
print(line)
if 'some string' in line:
break
# or from file path
for line in tail.readlines('access.log'):
print(line)
if 'some string' in line:
break
# b'line 10\r\n'
# b'line 9\r\n'
# b'line 8\r\n'
# b'line 7\r\n'
# ....
# decoding lines from encoding info
for line in tail.readlines('access.log', encoding='utf-8', errors='ignore'):
print(line)
# line 10
# line 9
# line 8
# line 7
# ....
Metadata
Release files for tailread 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tailread-1.0.2.tar.gz | 2.7 kB | Without provenance | Details for tailread-1.0.2.tar.gz |
Release files / tailread-1.0.2.tar.gz
| Download URL | tailread-1.0.2.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ab113f8defdf88f80b6d3b2ca7c34be2000bd53499504adc2b845e1c0742650
|
|
BLAKE2b-256 checksum How to use checksums |
0a6bb79e2b8774594eb6d011a3c9cbdffa4c4233c00c368a010fb1cbd2ea9545
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.0
|
Security for tailread 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.