cjkjust
Having strings containing CJK characters left-, right-justified or centered conveniently.
Installation
pip install cjkjust
Functions
is_wide(char) -> bool: returns whether a charactercharis widecjklen(string) -> int: returns the display width of astringcontaining CJK characterscjkljust(string, width: int, fillbyte=' '): hasstringleft-justifiedcjkrjust(string, width: int, fillbyte=' '): hasstringright-justifiedcjkcenter(string, width: int, fillbyte=' '): hasstringcentered
Caveat: <TAB> in string ruins the print-out.
Examples
import cjkjust
# right-justify a column of strings
print(cjkjust.cjkrjust('hello 世界', 20))
print(cjkjust.cjkrjust('你好world', 20))
print(cjkjust.cjkrjust('again and again', 20))
Optional dependency
wcwidth: if installed, 0-width characters will also be well handled incjkljust,cjkrjust, andcjkcenter. Caveat: installingwcwidthand explicitly setcjkjust.raises_on_indeterminatetoTrueimplies thatValueErrorwill be raised if indeterminate-width-characters (e.g.<TAB>) is instring
It can be installed along with cjkjust by:
pip install cjkjust[allchars]
Metadata
Release files for cjkjust 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cjkjust-0.1.4.tar.gz | 3.3 kB | Without provenance | Details for cjkjust-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cjkjust-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for cjkjust-0.1.4-py3-none-any.whl |
Total release size: 6.8 kB
Release files / cjkjust-0.1.4.tar.gz
| Download URL | cjkjust-0.1.4.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
83d981b19118619bd52424291e8ccf7fcb89a4b6f116d7b0bdf614b8da76eba7
|
|
BLAKE2b-256 checksum How to use checksums |
710832873be28e3ae14259a498b92d877f64d85b5be79409c1c204f1b460483b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7
|
Release files / cjkjust-0.1.4-py3-none-any.whl
| Download URL | cjkjust-0.1.4-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39a1d85b09b6f73c78e9e83fd2d587fb0c905bcc9e8e4ec235d64b695bf9da73
|
|
BLAKE2b-256 checksum How to use checksums |
6328b9f8bd9d420f22b5cd7fc66ddd9ec581399d6a597ea6738d4d0217832cd5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7
|
Security for cjkjust 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.