Metadata-Version: 2.1
Name: lhutils
Version: 0.0.4
Summary: 对常用代码进行封装，防止自己重复造轮子。
Author-email: lh <tasbox@163.com>
License: Copyright (c) 2018 The Python Packaging Authority
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/tasbox/lhutils
Project-URL: Bug Tracker, https://github.com/tasbox/lhutils/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE

# 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




## 

秒转时间

```python
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
    """
```


下载文件并保存

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

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