Python 3 开发工具集合 Borax

码农软件 · 软件分类 · 常用工具包 · 2019-08-12 14:28:57

软件介绍

 ____
| __ )  ___  _ __ __ ___  __
|  _ \ / _ \| '__/ _` \ \/ /
| |_) | (_) | | | (_| |>  <
|____/ \___/|_|  \__,_/_/\_\

Borax 是一个Python3开发工具集合,包含了常用的数据结构和设计模式。

模块

包括了以下模块:

  • 中国农历日期 borax.calendars.lunardate

  • 国际/国内节日 borax.calendars.festivals

  • 树形数据结构 borax.structures.tree

  • 单例模式 borax.patterns.singleton

  • 代理模式 borax.patterns.lazy

  • json序列化 borax.serialize.bjson / borax.serialize.cjson

  • 财务金额格式化 borax.finance

  • 别名字典、属性字典 borax.dictionary

  • 列表常用函数 borax.utils

使用示例

农历日期

>>>from borax.calendars.lunardate import LunarDate, LCalendars
>>>LunarDate(2018, 7, 1)
LunarDate(2018, 7, 1, 0)
>>>ld = LunarDate.from_solar_date(2018, 8, 11)
>>>ld
LunarDate(2018, 7, 1, 0)
>>>LCalendars.ndays(2018)
354
>>>LCalendars.ndays(2018, 12)
30
>>>LCalendars.ndays(2017, 6, 1)
30

金额大写

>>> from borax.finance import financial_amount_capital
>>> financial_amount_capital(100000000)
'壹亿元整'
>>>financial_amount_capital(4578442.23)
'肆佰伍拾柒万捌仟肆佰肆拾贰元贰角叁分'
>>>financial_amount_capital(107000.53)
壹拾万柒仟元伍角叁分

字段选取

from borax.fetch import fetch

objects = [
    {'id': 282, 'name': 'Alice', 'age': 30},
    {'id': 217, 'name': 'Bob', 'age': 56},
    {'id': 328, 'name': 'Charlie', 'age': 56},
]

names = fetch(objects, 'name')
print(names)

更多示例查看 https://kinegratii.github.io/borax

本文地址:https://codercto.com/soft/d/12206.html

永无止境

永无止境

[美] 道格拉斯•艾德华兹 / 刘纯毅 / 中信出版社 / 2012-12-15 / 59.00元

★ 值得中国初创公司反复思考的企业传记 ★ 互联网行业必读书 ★ Google高管揭开Google的神秘面纱 ★ 探寻“G力量”重塑人类知识景观的心路历程 ★ Google走过的路,Google未来的路 ★ 编辑推荐: 它是目前被公认为全球最大的搜索引擎!它是互联网上五大最受欢迎的网站之一! 它在操作界面中提供多达30余种语言选择,在全球范围内拥有无数用户......一起来看看 《永无止境》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

SHA 加密
SHA 加密

SHA 加密工具