Skip to main content

k3pattern

Action-CI Documentation Status Package

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.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for k3pattern 0.1.8
File Size Uploaded
k3pattern-0.1.8.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for k3pattern 0.1.8
File Interpreter ABI Platform
k3pattern-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 10.3 kB

Release files / k3pattern-0.1.8.tar.gz

Download URL k3pattern-0.1.8.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4e3db031568a87cc1197dbe7573ffa1af500bd66b48e56410f8c5ed56b68ae66
BLAKE2b-256 checksum
How to use checksums
6fa04f387fa4dd5b01df8b138c22b6090a0802992d662b7ee0236184500e0bcd
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.8-py3-none-any.whl

Download URL k3pattern-0.1.8-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6d85267858e718cd494aecfa5641b48d2b4ed913709cf14965e6600ef721999
BLAKE2b-256 checksum
How to use checksums
ae4bf1b61fcff5f95c498ee6c10f6f661aec8c850c60879058bd49b5669f0fc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page