stringcontext
Simple Python library functions for getting the context around an index location in a string.
This library was designed to handle retrieving a given amount of context around, before, or after an index location in a string.
context_after: returns the string ofncharacters after the given index, or until the end of the string.context_before: returns the string ofncharacters before the given index, or until the beginning of the string.context: returns the full string of the context before, after, and including the character at index.
The code handles out of range issues on both ends of the string.
Based on the grep program's -C option switch
Usage
import stringcontext
string = "Hello World test"
index = 5 # the space char
c = stringcontext.context(string, index, 5)
# "Hello World"
Metadata
Release files for stringcontext 1.0.0
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 |
|---|---|---|---|---|
| stringcontext-1.0.0.tar.gz | 2.7 kB | Without provenance | Details for stringcontext-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stringcontext-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for stringcontext-1.0.0-py3-none-any.whl |
Total release size: 6.1 kB
Release files / stringcontext-1.0.0.tar.gz
| Download URL | stringcontext-1.0.0.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
06848cacc641aa2f5f7747743f4338dbe9d88935f954de7e893dd1218325b6c0
|
|
BLAKE2b-256 checksum How to use checksums |
4ce0ce4dab55adb7297954ee0d33bf3c4010989709a13413ff7bff90d455277b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
|
Release files / stringcontext-1.0.0-py3-none-any.whl
| Download URL | stringcontext-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
045d1fe435a01c050c4d8563f8cd60625bc4a4f1dfc357dec6001c7c840b71e4
|
|
BLAKE2b-256 checksum How to use checksums |
e91bbdfb65f31014117f6a1140116e0e19ca3ce9413e8256c9ece3f5d3230f0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
|
Security for stringcontext 1.0.0
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.