Skip to main content

Handling lines with arbitrary separators

Project description

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. MIT License

GitHub | PyPI | Issues

This module provides basic functions for reading & writing text with custom line separators that can occur either before, between, or after lines — though its primary purpose is actually to allow me to experiment with proper Python packaging & testing procedures. Being actually useful is not its #1 goal.


Just use pip (You have pip, right?) to install linesep:

pip install linesep


Reading paragraphs separated by a blank line:

with open('text.txt') as fp:
    for entry in linesep.read_separated(fp, '\n\n'):

Parsing output from find -print0:

find = subprocess.Popen(
    ['find', '/', '-some', '-complicated', '-condition', '-print0'],
for filepath in linesep.read_terminated(find.stdout, '\0'):

A poor man’s JSON Sequence parser:

for entry in linesep.read_preceded(fp, '\x1E'):
        obj = json.loads(entry)
    except ValueError:
        yield obj

Project details

Download files

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

Files for linesep, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size linesep-0.1.1-py2.py3-none-any.whl (7.1 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size linesep-0.1.1.tar.gz (8.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page