some usual tool with class
Project description
function_tool工具包
安装:
pip install function_tool
本工具包对一些常用的功能进行了Python封装,目前主要包含以下功能:
1. 日期时间类
DateTimeTool
- timestamp2time函数:Unix时间戳转时间字符串
- time2timestamp函数:时间字符串转Unix时间戳
- get_range_of_date_by_str函数:返回给定时间所在日期的时间戳范围 使用示例
from function_tool_derrick.UsualTool import DateTimeTool # 导入function_tool_derrick.UsualTool下的DateTimeTool类
if __name__ == '__main__':
print(DateTimeTool.timestamp2time(1681721029)) # 打印 2023-04-17 16:43:49
print(DateTimeTool.time2timestamp('2023-04-17 16:43:49')) # 打印 1681721029
ret = DateTimeTool.get_range_of_date_by_str('2022-02-02 15:30:28', formatter='%Y-%m-%d %H:%M:%S', tsType=TimestampType.MILLISECOND)
print(ret) # 打印 [1643731200000, 1643817599999]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
function_tool-0.0.3.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for function_tool-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b182cb9dc55024cb405b0a6323317f058f93dc2eede6eb2220ea01b299636bc |
|
MD5 | 7f86de5206279b17d89180f3df0edafd |
|
BLAKE2b-256 | 67a05299779466194995304805a088f026bb1b892430c56a35b1958aa733b398 |