Skip to main content

对常用代码进行封装,防止自己重复造轮子。

Project description

lhutils

对常用代码进行封装,防止自己重复造轮子。

github: https://github.com/tasbox/lhutils.git

官方文档:

https://packaging.python.org/en/latest/tutorials/packaging-projects/

pypi:

https://pypi.org/

https://pypi.tuna.tsinghua.edu.cn/simple

秒转时间

def sec2time(seconds: int):
    """
    秒转时间

    :param seconds: 秒
    :return

    >>> sec2time(60)
        00:01:00
    >>> sec2time(60*60)
        01:00:00
    >>> sec2time(60*60*24)
        1 days, 00:00:00
    """

下载文件并保存

def download_file(
        url: str,
        file: str,
        cache=True,
        unbroken=True,
        ** kwargs
):
    """
    下载文件并保存

    :param url: 网络文件地址
    :param file: 本地文件地址
    :param cache: 把本地文件作为缓存条件,检查缓存是否存在,如果存在就不会下载网络文件
    :param unbroken: 检查下载的文件的完整性,防止因为网络问题导致文件下载完整。
    :param **kwargs: requests(..., **kwargs)
    """

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

lhutils-0.0.5.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

lhutils-0.0.5-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file lhutils-0.0.5.tar.gz.

File metadata

  • Download URL: lhutils-0.0.5.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.0

File hashes

Hashes for lhutils-0.0.5.tar.gz
Algorithm Hash digest
SHA256 384772299d57e349fc4f9ff44680b0c75fb1bb51005529925844a11f3d4eae8b
MD5 70e7e1c8561f016001ea592bf2fffba3
BLAKE2b-256 8c153f043899a080c09eaf0ea4675914f4a142a0d6485aeb20358ae7ef147b74

See more details on using hashes here.

File details

Details for the file lhutils-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: lhutils-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.0

File hashes

Hashes for lhutils-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a4a845598e2011ca92fc208714fec2ff7c56f4cd6ca0c0573072027ad14e301a
MD5 ef9154073ad5133c753842e996a381aa
BLAKE2b-256 aa38e3cb3d6e840d54ddc765ec0f3c220cf1015821d2e304635b4a5c8eb5f4ad

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