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.1.tar.gz (185.4 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: cm_chengyu-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 be3d123f6e1a9fb2f297b695c6c3f08a117ca3ed52b06380be989ce224d4a9d5
MD5 1a8be9d0031915c72d9bbfeb267da0f7
BLAKE2b-256 5e0d8089cec5385af082246d709c389205ddb654e5e2db33507a443bf01285c4

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