处理计时数据的一个函数
Project description
sanitize-jhlong
项目简介
sanitize-jhlong 是一个用于处理时间数据的 Python 函数库,能够将时间字符串格式化为标准的 分钟.秒钟 格式。该库的设计目标是帮助开发者更方便地处理和格式化时间数据。
安装方法
您可以通过以下命令从 PyPI 安装该库:
pip install sanitize-jhlong
使用方法
导入库并调用sanitize 函数:
from sanitize_jhlong import sanitize
# 示例
time_string = "2:34"
formatted_time = sanitize(time_string)
print(formatted_time) # 输出 "2.34"
功能说明
-时间格式转换:支持分钟:秒钟 和分钟-秒钟格式的转换
-错误处理:当输入数据不符合标准格式时,会自动返回原始字符串,确保代码运行的稳定性。
-(在 Markdown 中,您可以通过在子项前增加四个空格来创建嵌套列表:)
示例代码
以下是一些使用示例:
from sanitize_jhlong import sanitize
# 支持的时间格式
print(sanitize("2:45")) # 输出 "2.45"
print(sanitize("3-21")) # 输出 "3.21"
# 不支持的格式将返回原始字符串
print(sanitize("hello")) # 输出 "hello"
贡献指南
如果您有兴趣为 sanitize-jhlong项目做出贡献,欢迎提交 pull request 或 issue!
我们乐意接受任何有助于改进项目的反馈和建议。
联系方式
如果您在使用过程中遇到问题,请联系作者:jhlong2024@163.com
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sanitize_jhlong-1.0.2.tar.gz.
File metadata
- Download URL: sanitize_jhlong-1.0.2.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54fec93afc46758b0654555ec034e3d500f0e44763d78dfd5a3be57acf489e75
|
|
| MD5 |
5a61c76c8b14ad4ac1edb06328aa905d
|
|
| BLAKE2b-256 |
fe979d0cbb5036bdd69aeb1940a96d545bcb54ad3bfa5327a2687de3390cae71
|
File details
Details for the file sanitize_jhlong-1.0.2-py3-none-any.whl.
File metadata
- Download URL: sanitize_jhlong-1.0.2-py3-none-any.whl
- Upload date:
- Size: 2.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00d8feba3677c3466d46f2a08a2a5137a997a2e20fae9e7fd5d41daeedbcde79
|
|
| MD5 |
90cbc7f02e200be6af040f0528369a40
|
|
| BLAKE2b-256 |
b3f37381ed96ad8065dc1e5c5d1d96b6981f140e436e0c7b73aa02e1ce95a66a
|