Skip to main content

四字成语工具库:判断成语、随机抽取,收录 29502 个四字成语

Project description

chengyu-cm 四字成语工具库

一个简单好用的 Python 四字成语工具库,收录 29502 个四字成语。

安装

pip install chengyu-cm

使用方法

判断是否是成语

from chengyu_cm import is_chengyu

print(is_chengyu('守株待兔'))  # True
print(is_chengyu('你好世界'))  # False

随机抽取一个成语

from chengyu_cm import random_chengyu

print(random_chengyu())  # 随机输出一个四字成语

其他功能

from chengyu_cm import all_chengyu, count

print(count())          # 29502(成语总数)
cylist = all_chengyu()  # 获取所有成语的列表

数据来源

成语数据来自开源项目 chinese-xinhua,经筛选仅保留四字成语。

Project details


Download files

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

Source Distribution

chengyu_cm-1.0.0.tar.gz (185.4 kB view details)

Uploaded Source

File details

Details for the file chengyu_cm-1.0.0.tar.gz.

File metadata

  • Download URL: chengyu_cm-1.0.0.tar.gz
  • Upload date:
  • Size: 185.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for chengyu_cm-1.0.0.tar.gz
Algorithm Hash digest
SHA256 039c8cdf33c520d39926242c5eaf55adbe4cae4352c70eeb1719f306f42dc270
MD5 1751cba2b1467a040fbe24d366f72f86
BLAKE2b-256 71c34d77a3493a456e8dbd23e3bb01c437efde9bb6af2b7239ef0a1e7672e881

See more details on using hashes here.

Supported by

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