chinese-year-calc
中国纪年计算器。
用法
主用法
使用TIANGAN获取年份的天干
from chyear import (get_chinese_year, TIANGAN)
year = 2021
tiangan = get_chinese_year(year, TIANGAN)
print(tiangan) # 输出:'辛'
使用DIZHI获取年份的地支
from chyear import (get_chinese_year, DIZHI)
year = 2021
dizhi = get_chinese_year(year, DIZHI)
print(dizhi) # 输出:'丑'
使用SHENGXIAO获取年份的生肖
from chyear import (get_chinese_year, SHENGXIAO)
year = 2021
shengxiao = get_chinese_year(year, SHENGXIAO)
print(shengxiao) # 输出:'牛'
可以使用位运算符号|来组合信息
from chyear import (get_chinese_year, DIZHI, TIANGAN)
year = 2021
dizhi_tiangan = get_chinese_year(year, DIZHI | TIANGAN)
print(dizhi) # 输出:'辛丑'
DIZHI | TIANGAN等价于ZHIGAN
from chyear import (get_chinese_year, ZHIGAN)
year = 2021
zhigan = get_chinese_year(year, ZHIGAN)
print(dizhi) # 输出:'辛丑'
DIZHI | SHENGXIAO等价于DIZHI_SHENGXIAO
from chyear import (get_chinese_year, DIZHI_SHENGXIAO)
year = 2021
dizhi_shengxiao = get_chinese_year(year, DIZHI_SHENGXIAO)
print(dizhi) # 输出:'丑牛'
ALL可以获取全部信息, 即TIANGAN | DIZHI | SHENGXIAO
from chyear import (get_chinese_year, ALL)
year = 2021
info = get_chinese_year(year, ALL)
print(info) # 输出:'辛丑牛'
ADD_YEAR_END可以在字符最后加上'年'
from chyear import (get_chinese_year, ADD_YEAR_END, ALL)
year = 2021
all_add_year_end = get_chinese_year(year, ALL | ADD_YEAR_END)
print(info) # 输出:'辛丑牛年'
其他变量
TIANGAN_LIST获取天干列表。 DIZHI_LIST获取地支列表。 SHENGXIAO_LIST获取生肖列表。
from chyear import (TIANGAN_LIST, DIZHI_LIST, SHENGXIAO_LIST)
print(TIANGAN_LIST) # 输出:['甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸']
print(DIZHI_LIST) # 输出:['子', '丑', '寅', '卯', '辰', '巳', '午', '未', '申', '酉', '戌', '亥']
print(SHENGXIAO_LIST) # 输出:['鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊', '猴', '鸡', '狗', '猪']
命令行
命令行用法
chyear year calc_info [calc_info1 [calc_info2 [...]]] [--add-year-end | -y]
calc_info可以是TIANGAN, DIZHI, SHENGXIAO, ALL, ZHIGAN和SHENGXIAO_TIANGAN中的一个或多个, 语法跟python的用法一样。
如:
chyear 2021 TIANGAN DIZHI SHENGXIAO --add-year-end # 相当于get_chinese_year(2021, TIANGAN | DIZHI | SHENGXIAO | ADD_YEAR_END), 输出:'辛丑牛年'
Metadata
Release files for chinese-year-calc 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chinese_year_calc-0.1.1.tar.gz | 5.1 kB | Without provenance | Details for chinese_year_calc-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chinese_year_calc-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for chinese_year_calc-0.1.1-py3-none-any.whl |
Total release size: 10.6 kB
Release files / chinese_year_calc-0.1.1.tar.gz
| Download URL | chinese_year_calc-0.1.1.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc002fd3195212d07621cd021eae79e448ae92240bf6ff6fe30349ec91cd3a7d
|
|
BLAKE2b-256 checksum How to use checksums |
17d5528ea9d4d2b2fc5a6c0203805685d469c8518c13f9f0a86b58b3bb9a2fea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Release files / chinese_year_calc-0.1.1-py3-none-any.whl
| Download URL | chinese_year_calc-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3b49c2e2ef4b007d2425a299bcb2fec74fe586f152243ca805a208a751a339f
|
|
BLAKE2b-256 checksum How to use checksums |
6c0865653dc54c0747528f55cbf446cf74412ab954a096b411fedc2cc5cfbe7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.3
|
Security for chinese-year-calc 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.