Generate inclusive lexicographic ranges of strings
Project description
strrange
Generate inclusive lexicographic ranges of strings.
Synopsis
pip install strrange
>>> from strrange import range as srange
>>> list(srange('a', 'm'))
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm']
>>> list(srange('file001.txt', 'file004.txt'))
['file001.txt', 'file002.txt', 'file003.txt', 'file004.txt']
>>> list(srange('A', 'XFD'))
# A complete list of all column names in Excel.
>>> list(srange('i)', 'iii)'))
['i)', 'ii)', 'iii)']
>>> list('AA' + srange('QM', 'QZ') + srange('XA', 'XZ') + 'ZZ')
# Output: list of ISO 3166-1 alpha-2 codes for private use
Overview
The strrange is a Python library that helps produce sequences of strings given the first and last element. It is designed to cover common practical cases like file names, numeric identifiers, and alphanumeric codes.
It attempts to “guess” the progression by analyzing numeric parts, repeated substrings, and alphanumeric regions (0–9A–Za–z). If no obvious pattern is found, it simply yields [start, stop].
⚠️ Alpha version: algorithms are heuristic and may change.
If you encounter results that seem unexpected, please share examples — even if they won’t always lead to changes (what is unexpected for one user may be the intended logic for another), they help us understand real-world cases.
Examples are welcome as issue reports or pull requests.
Documentation
Read the full documentation at Read the docs.
License
Copyright 2025 Oleh Alistratov
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file strrange-0.2.tar.gz.
File metadata
- Download URL: strrange-0.2.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
801b9fdc77ca43cf0f642fd7a01e5ecdd7a518f75249446771820d53c30d546c
|
|
| MD5 |
f8b24cd5af7a9c7a48b02eb0cb42e917
|
|
| BLAKE2b-256 |
8b26670547da87d365b2a09233bdfbb6ed76004190ce58b4b3a2d3fd0cff2451
|
File details
Details for the file strrange-0.2-py3-none-any.whl.
File metadata
- Download URL: strrange-0.2-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fbd58d757ec772d8e489301c21ea683d3b15cc1f194cd3bdcf010526b9090ce
|
|
| MD5 |
076ad35b0145ddf5a28d263727119903
|
|
| BLAKE2b-256 |
079e1411fcfd5540ab0035767bb2459ecf23a8008b55924a7f6a0e0c5804e2f0
|