jeraconv(日文纪元名称转换器)是一个将日文纪元转换为西历的转换器。

jeraconv的Python项目详细描述


杰拉科诺夫

jeraconv(日文纪元名称转换器)是一个将日文纪元转换为西历的转换器。

安装

$ pip install jeraconv

用法

日文日历到西文日历

fromjeraconvimportjeraconv# Create J2W class instancej2w=jeraconv.J2W()# ex.1 : General usageprint(j2w.convert('文治6年'))# result (int) 1190# ex.2 : Full-width numbers are also availableprint(j2w.convert('平成31年'))# result (int) 2019# ex.3 : It is also possible to write "1年" as "元年"print(j2w.convert('令和元年'))# result (int) 2019# ex.4 : Returns a ValueError if the era name does not existprint(j2w.convert('牌孫4年'))# result ValueError

西方日历到日本日历。

fromjeraconvimportjeraconv# Create W2J class instancew2j=jeraconv.W2J()# ex.1 : General usageyear=2019month=5day=31print(w2j.convert(year,month,day))# result (str) 令和1年5月31日# ex.2 : When receiving a response in dictionary typeprint(w2j.convert(year,month,day,return_type='dict'))# result (dict) {'era': '令和', 'year': 1, 'month': 5, 'day': 31}# ex.3 : When receiving a response in list typeprint(w2j.convert(year,month,day,return_type='list'))# result (list) ['令和', 1, 5, 31]# ex.4 : When receiving a response in tuple typeprint(w2j.convert(year,month,day,return_type='tuple'))# result (tuple) ('令和', 1, 5, 31)# ex.5 : If the date is omitted, convert the execution dateprint(w2j.convert())

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java线程执行器服务   aspose如何通过java获得单词bookmark之前的所有文本内容?   一对一映射的java Hibernate合并问题   java SOAP XSD根元素问题   java如何保护我的Spring启动API   java使用GeoJson向google地图添加标记   java安卓:在SQLite中没有这样的列   java STS 2.8.0 StartExplorer/Legacy插件安装问题   java如何以编程方式获取AppBar高度?   在Java中将BigDecimal添加到BigDecimal   java不支持ntdll。dll是windows xp和windows vista的标准配置吗?   内容类型为application/xwwwformurlencoded的java Http Put请求在Spring中不起作用   java在数组中计算工资并返回答案   java数字/货币格式   elasticsearch java api中的弹性搜索查询