xToolkit是python内置库的一个扩展库.把python的datetime,string,list,dist等数据结构重新进行了封装,扩展了部分功能.
- 适用对象:python工程师
- 作者:熊利宏
- 邮箱:xionglihong@163.com 有任何意见欢迎发送邮件,我们一起打造一个好用的python内置库的扩展库
什么是xToolkit库?
库xToolkit的中文名字叫X工具集.是python内置库的一个扩展库.把python的datetime,string,list,dist等数据结构重新进行了封装,扩展了部分功能.
操作文档
https://www.showdoc.cc/xToolkit?page_id=2133295307421808
实例:
导入xToolkit库
from xToolkit import xstring, xdatetime
判断时间格式时分正确
# 判断时间格式"1988-07-20"是否合规
xdatetime.shape("1988-07-20")
>>True
# 判断时间格式"1988-07-88"是否合规
xdatetime.shape("1988-07-88")
>>False
# 判断时间格式"98787987"是否合规
xdatetime.shape("98787987")
>>True
时间模块的get方法
# 获取当前时间
xdatetime.get().format()
>>2020-03-30 20:52:10
# 输出当前iso时间
xdatetime.get()
>>2020-03-30T20:55:09.125681+08:00
# 时间戳转时间格式
xdatetime.get(1584689499).format()
>>2020-03-20 15:31:39
# 时间字符串转时间
xdatetime.get("2020-03-20T22:09:06.252525+0800").format()
>>2020-03-20 22:09:06
时间模块的get方法
# 函数一
def function_1(a, b, c):
time.sleep(1)
return a * 2, b * 2, c * 2
# 函数二
def function_2(a, b):
time.sleep(1)
return a * 2, b * 2
# 函数三
def function_3(a):
time.sleep(1)
return a * 2
# 函数四
def function_4():
time.sleep(1)
return 0
st = time.time()
result = xthreading([function_1, 1, 1, 1], [function_2, 2, 2], [function_3, 2], [function_4])
print(result[0])
print(result[1])
print(result[2])
print(result[3])
et = time.time()
print("运行时间:{}".format(et - st))
>> (2, 2, 2)
>> (4, 4)
>> 4
>> 0
>> 运行时间:1.0010571479797363
# 从上面的运行时间可以看出,如果单线程执行应该是4秒以上,结果为1秒,说明运行时是多线程运行
更多实例请参照参考文档 https://www.showdoc.cc/xToolkit?page_id=2133295307421808
更新说明:
2019年05年10日 V0.0.10
- xToolkit 上线啦
- 新增获取当前时间功能
2019年05年16日 V0.0.12
- 新增格式化时间format功能,更人性化的输出时间格式
- 新增推移时间功能
- 新增替换时间功能
- 新增判断时间格式是否正确功能
- 新增获取时间区间功能
2019年06月11日 V0.0.21
- 新增字符串效验功能
2019年08月20日 v0.0.25
- 新增中国居民身份证效验功能
- 新增中国大陆手机号码效验功能
- 新增数字效验功能
2019年09月02日 v0.0.30
- 新增浮点数,银行卡效验
2020年05月28日 v0.0.43
- 新增字符串 split多分割标识
2020年06月06日 v0.0.46
- 修护获取指定月最后一天,输入整数型字符串报错的BUG
- 新增判断整数,扩充了string.isdigit()
2020年06月22日 v0.0.47
- 新增字符串 strip多过滤标识
2020年06月28日 v0.0.48
- 修改了手机号格式判断如果为纯数字报错的BUG
- 新增多线程模块
Metadata
Release files for xToolkit 0.0.48
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 |
|---|---|---|---|---|
| xToolkit-0.0.48.tar.gz | 14.6 kB | Without provenance | Details for xToolkit-0.0.48.tar.gz |
Release files / xToolkit-0.0.48.tar.gz
| Download URL | xToolkit-0.0.48.tar.gz |
|---|---|
| Size | 14.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1061ae91479f81e6a2add1e7078f1ce1aad397784ca6b4c146829b7c69bfc46
|
|
BLAKE2b-256 checksum How to use checksums |
673f4c8fa05a7f7046b2d54225c33e58c660e6f47b4c1f89da88cd5183dc11a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.5
|
Security for xToolkit 0.0.48
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.