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.4.tar.gz (3.4 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.4-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lhutils-0.0.4.tar.gz
  • Upload date:
  • Size: 3.4 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.4.tar.gz
Algorithm Hash digest
SHA256 1018d74ba807c67dfc98cf895aa97cbad1794b62eaf37ad086f3c0345860542e
MD5 eadcb65a7685725e4bba9485277feb7e
BLAKE2b-256 621d8c7c56aa6d00314bf1fee883f69b4f6ca5128f61ee11e98fb1e2a42daa8c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lhutils-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.6 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e250fc165834ba054de6eeb72614dee3ff601c3109daf2bbc054b4bff3c01fb1
MD5 56dad64fac78033a1c769f96da012ed9
BLAKE2b-256 4ff97aee50503b37eb9ccbcf6cabccec1833184e27e7df12643fb17002ed5247

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