k3pattern
Find common prefix of several strings, tuples of string, or other nested structure, recursively by default.
k3pattern is a component of pykit3 project: a python3 toolkit set.
Find common prefix of several string, tuples of string, or other nested structure, recursively by default. It returns the shortest prefix: empty string or empty tuple is removed.
Install
pip install k3pattern
Synopsis
import k3pattern
k3pattern.common_prefix("abc", "abd") # 'ab'
k3pattern.common_prefix((1, 2, "abc"), (1, 2, "abd")) # (1, 2, 'ab')
k3pattern.common_prefix((1, 2, "abc"), (1, 2, "xyz")) # (1, 2); empty prefix of 'abc' and 'xyz' is removed
k3pattern.common_prefix((1, 2, (5, 6)), (1, 2, (5, 7))) # (1, 2, (5,) )
k3pattern.common_prefix("abc", "abd", "abe") # 'ab'; common prefix of more than two
Author
Zhang Yanpo (张炎泼) drdr.xp@gmail.com
Copyright and License
The MIT License (MIT)
Copyright (c) 2015 Zhang Yanpo (张炎泼) drdr.xp@gmail.com
Metadata
Release files for k3pattern 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| k3pattern-0.1.6.tar.gz | 5.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| k3pattern-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.5 kB
Release files / k3pattern-0.1.6.tar.gz
| Download URL | k3pattern-0.1.6.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21d3421c8b924925ef7a9155336434d0637fd1b1286b70f3c011e25829a7aec9
|
|
BLAKE2b-256 checksum How to use checksums |
83a8763aeeb6f4240990ffdd59d07a7aa48c511e5f7726af4ff316c61ef7c55e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / k3pattern-0.1.6-py3-none-any.whl
| Download URL | k3pattern-0.1.6-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
370fab5eb5d0da1dc684c81109cd149c85fd94503206b374e2276e7117d94f30
|
|
BLAKE2b-256 checksum How to use checksums |
7cbeee276fa193015c254ab455505a26ffd3580555460fa447c49e14934b1039
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|