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.
Metadata
Release files for strrange 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 | |
|---|---|---|---|
| strrange-0.2.tar.gz | 12.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| strrange-0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.9 kB
Release files / strrange-0.2.tar.gz
| Download URL | strrange-0.2.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
801b9fdc77ca43cf0f642fd7a01e5ecdd7a518f75249446771820d53c30d546c
|
|
BLAKE2b-256 checksum How to use checksums |
8b26670547da87d365b2a09233bdfbb6ed76004190ce58b4b3a2d3fd0cff2451
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / strrange-0.2-py3-none-any.whl
| Download URL | strrange-0.2-py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3fbd58d757ec772d8e489301c21ea683d3b15cc1f194cd3bdcf010526b9090ce
|
|
BLAKE2b-256 checksum How to use checksums |
079e1411fcfd5540ab0035767bb2459ecf23a8008b55924a7f6a0e0c5804e2f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|