This Python 3 module provides utility functions for formatting fixed-width CJK strings.
Project description
CJK Format
This Python 3 module provides utility functions for formatting fixed-width CJK strings. One of the most important features of tihs module is to align Latin and CJK characters using %{width}s specifiers. For example, the following lines
print('%-10s|%-10s|' % ('ab', 'cd'))
print('%-10s|%-10s|' % ('가나다라', '마바사아'))
will print misaligned lines between Latin and CJK characters even with the %-10s specifiers.
Now, using this module's f() function, the above example would be
from cjkformat import f
print(f('%-10s|%-10s|', 'ab', 'cd'))
print(f('%-10s|%-10s|', '가나다라', '마바사아'))
which will print nicely aligned output.
The module also defines a shortcut function printf() to minic the same function in the C language. For example,
from cjkformat import printf
printf('%-10s|%-10s|\n', 'ab', 'cd')
printf('%-10s|%-10s|\n', '가나다라', '마바사아')
For more information, please visit the GitHub repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cjkformat-0.1.1.tar.gz.
File metadata
- Download URL: cjkformat-0.1.1.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
856ad7d7adc1806643d9f6b7bd33fc3a6e527e37235e29483ec03a9cee878ab3
|
|
| MD5 |
3e48c929f77fc7bdfc2dbe9d9b33606c
|
|
| BLAKE2b-256 |
b00b6ee8994104d82a3629ca9a5c47c37eef4588cc5a55c10ca17145723c84f1
|
File details
Details for the file cjkformat-0.1.1-py3-none-any.whl.
File metadata
- Download URL: cjkformat-0.1.1-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4598b06fd76a8b305d0f5b7639c66dbc9a8326334e41e6377edbdda80f182d85
|
|
| MD5 |
2574c5c0ed0681413a6aa99c3550ceb6
|
|
| BLAKE2b-256 |
4bafed336e4f0a89b99bb6b00cac22fc9c13937f97c1c84cf6384ad2155bad1d
|