Skip to main content

Generate inclusive lexicographic ranges of strings

Project description

strrange

Generate inclusive lexicographic ranges of strings.

PyPI - Version codecov Documentation Status PyPI - Downloads

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 or — 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


Download files

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

Source Distribution

strrange-0.1.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

strrange-0.1-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file strrange-0.1.tar.gz.

File metadata

  • Download URL: strrange-0.1.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for strrange-0.1.tar.gz
Algorithm Hash digest
SHA256 350af4c1acdc1ba795b8759082f6207c2baf8c5fd3d1f752a688404e64658d0e
MD5 43cd244ff119c459f4251ec7884fd268
BLAKE2b-256 d984fd2c55edeb69a5962c4d46497a2c11df7ed3b6885f06fd58da2b4791fb75

See more details on using hashes here.

File details

Details for the file strrange-0.1-py3-none-any.whl.

File metadata

  • Download URL: strrange-0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.23

File hashes

Hashes for strrange-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4c01e3774bd3d3c9e021cdd11563434e31a1aef1a30940986dc46db66d4167ae
MD5 7500a1e783b68c906c8c6bcb1a6e05e4
BLAKE2b-256 d1afd82571100579d8dfe55ca14c6888cc9c51c3474a168a1d1dd224044e0c6b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page