Split line streams into managable chunks
Project description
spliterator
Split line streams into managable chunks
Usage
Take things.txt as follows.
Thing Name Thing 1
Thing Color Red
Thing Hair Big
Thing Motto I am Number 1!
Thing Name Thing 2
Thing Color Red
Thing Hair Big
Thing Motto Seconds Please!
And lets iterate through each line while adding in start and end events around each individual thing.
>>> import spliterator
>>> for event, line in spliterator.chunk(open('things.txt'), 'Thing Name'):
... print(event, line)
...
START None
LINE Thing Name Thing 1
LINE Thing Color Red
LINE Thing Hair Big
LINE Thing Motto I am Number 1!
END None
START None
LINE Thing Name Thing 2
LINE Thing Color Red
LINE Thing Hair Big
LINE Thing Motto Seconds Please!
END None
Now we can process specific things properly based on the event variable.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
spliterator-0.0.1.tar.gz
(2.1 kB
view details)
File details
Details for the file spliterator-0.0.1.tar.gz
.
File metadata
- Download URL: spliterator-0.0.1.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a0ea862866fd04e9602118e0c6f2582f4cf403c575a09c0fd279ea86ae95b2b |
|
MD5 | 0856affe71c81d159b9fa5f2658bc21b |
|
BLAKE2b-256 | b529c6d3a97ad2f9b2a45d12a324c67ef915b99651b8bf79a92b1bccdd13066f |