Skip to main content

处理计时数据的一个函数

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

sanitize_jhlong-1.0.4.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sanitize_jhlong-1.0.4-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

Details for the file sanitize_jhlong-1.0.4.tar.gz.

File metadata

  • Download URL: sanitize_jhlong-1.0.4.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

Hashes for sanitize_jhlong-1.0.4.tar.gz
Algorithm Hash digest
SHA256 10b9cff90929ea86540532053f0ff8e640589c9d6658fa6b91f55cf6e834718f
MD5 9d819b2a5db16e57f19345464895d156
BLAKE2b-256 03270cb56d9c1ba8d012d38d63e74a0248a53445208a18c82309dcb92c2628d2

See more details on using hashes here.

File details

Details for the file sanitize_jhlong-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for sanitize_jhlong-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 64179bbca4fe833d04127097c94a7199715c2d1da37ea00c5e0330c585795a5d
MD5 02b164ad5851e6c5412ab4b060d5ecc0
BLAKE2b-256 ef9b1dccb71b67e3099f32c8878a11a844a131c0badf5a3a3e49e414103b6e8a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page