Skip to main content

包含中文的字符串使用拼音比较大小,可用于使用拼音排序字符串等的需求。

Project description

pinyin-order

包含中文的字符串使用拼音比较大小,可用于使用拼音排序字符串等的需求。

from pinyin_order import PinyinOrderStr, pinyin_sorted


result1 = PinyinOrderStr('汉字和English') == PinyinOrderStr('汉子和english')  # True
result2 = PinyinOrderStr('汉字') > PinyinOrderStr('hanzi')  # True
result3 = PinyinOrderStr('abc啊') <= PinyinOrderStr('ABC哦')  # True

strings = ['a哦', 'a啊', '汉字', '这是abc', '者时ABC', '123', 'abc', '漢字', '🏀🐔🏀', ' ']
result4 = pinyin_sorted(strings)
# [' ', '123', 'abc', 'a啊', 'a哦', '汉字', '漢字', '这是abc', '者时ABC', '🏀🐔🏀']

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pinyin_order-0.0.1-py3-none-any.whl (3.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page