Skip to main content

计算概论C课程四字成语工具库:判断成语、随机抽取,收录 29502 个四字成语

Project description

cm-chengyu 四字成语工具库

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

安装

pip install cm-chengyu

使用方法

判断是否是成语

from cm_chengyu import is_chengyu

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

随机抽取一个成语

from cm_chengyu import random_chengyu

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

其他功能

from cm_chengyu 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

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

Uploaded Source

File details

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

File metadata

  • Download URL: cm_chengyu-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 cm_chengyu-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2c98c13df58b045d7a77cf9a39e188dbd9cbb31d9f3fcdd8047a19b0aa47f68f
MD5 0f383119612b2fd5c862f3100962ee8c
BLAKE2b-256 9718e83fa13a5b1fbe9ad46bbeefc7c708d6edef611e57ddb8400afc2087e03e

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