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
Hashes for cjkformat-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4598b06fd76a8b305d0f5b7639c66dbc9a8326334e41e6377edbdda80f182d85 |
|
MD5 | 2574c5c0ed0681413a6aa99c3550ceb6 |
|
BLAKE2b-256 | 4bafed336e4f0a89b99bb6b00cac22fc9c13937f97c1c84cf6384ad2155bad1d |