同步操作将从 kinegratii/borax 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Borax is a utils collections for python3 development, which contains some common data structures and the implementation of design patterns.
Use pip to install the package:
$ pip install borax
Or checkout source code:
git clone https://github.com/kinegratii/borax.git
cd borax
python setup.py install
The dataset and algorithm is referenced from jjonline/calendar.js.
from borax.calendars.lunardate import LunarDate
# Get the date instance of today.
print(LunarDate.today()) # LunarDate(2018, 7, 1, 0)
# Convert a solar date to the lunar date.
ld = LunarDate.from_solar_date(2018, 8, 11)
print(ld) # LunarDate(2018, 7, 1, 0)
# Return the lunar date after 10 days.
print(ld.after(10)) # LunarDate(2018, 7, 11, 0)
Return the lunar date after 10 days.
>>>ld.after(10)
LunarDate(2018, 7, 11, 0)
How many days away from spring festival,my birth day,Chinese New Year's Eve.
from borax.calendars.festivals import get_festival, LunarSchema, DayLunarSchema
festival = get_festival('春节')
print(festival.countdown()) # 7
ls = LunarSchema(month=11, day=1)
print(ls.countdown()) # 285
dls = DayLunarSchema(month=12, day=1, reverse=1)
print(dls.countdown()) # 344
Convert amount to financial capital numbers.
>>> from borax.finance import financial_amount_capital
>>> financial_amount_capital(100000000)
'壹亿元整'
>>>financial_amount_capital(4578442.23)
'肆佰伍拾柒万捌仟肆佰肆拾贰元贰角叁分'
>>>financial_amount_capital(107000.53)
壹拾万柒仟元伍角叁分
>>>from borax.patterns.singleton import MetaSingleton
>>>class SingletonM(metaclass=MetaSingleton):pass
>>>a = SingletonM()
>>>b = SingletonM()
>>>id(a) == id(b)
True
A function sets for fetch the values of some axises.
Get list values from dict list.
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)
Output
['Alice', 'Bob', 'Charlie']
See online document for more detail, which is powered by docsify .
This project is issued with MIT License, see LICENSE file for more detail.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。