Penut
Introduction
- This package is a collection of my useful functions, including some useful IO operations.
Installation
- You can install this package through pip:
$ pip install penut
Usage
- Easily load or dump and json/pkl/csv/npy file:
import penut.io as pio data = pio.load('data.json') data = pio.load('data.pkl') data = pio.load('data.csv') data = pio.load('data.npy') pio.dump(data, 'data.json') pio.dump(data, 'data.pkl') pio.dump(data, 'data.csv') pio.dump(data, 'data.npy')
- Easily measure the execution time of code:
import time from penut import TimeCost with TimeCost('Sleep Time'): time.sleep(1) # Output: Sleep Time: 1.000262s # With custom format fmt = lambda msg, tts: f'Hello {msg}, you cost {tts:.2f}s!!' with TimeCost('Custom Format', verbose_fmt=fmt): time.sleep(1) # Output: Hello Custom Format, you cost 1.00s!!
- Easily convert
datetime.timedeltato string:from penut import td2s from datetime import datetime a = datetime(2021, 1, 6, 11, 32, 23) b = datetime(2021, 1, 7, 12, 38, 17) d = b - a print(td2s(d)) # 62:17:54 fmt = lambda h, m, s: f'{h}h{m}m{s}s' print(td2s(d, fmt)) # 62h17m54s
Release files for penut 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| penut-0.0.2.tar.gz | 3.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| penut-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.3 kB
Release files / penut-0.0.2.tar.gz
| Download URL | penut-0.0.2.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f3d668788d061ae102ac751709cc6d3ce9c516424a9764516401168e829d7769
|
|
BLAKE2b-256 checksum How to use checksums |
f646fcb5f85e4ca797c8c9e9ac56901b1c781022e323cacf9750a66a8d8fac76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
|
Release files / penut-0.0.2-py3-none-any.whl
| Download URL | penut-0.0.2-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
48d0c438d03ecc4c972dac1a5fef166c963795b5c08788416bb2fbbf89a7da03
|
|
BLAKE2b-256 checksum How to use checksums |
f5cafa0268b12fa4693001b616f76c8528673070cd0905477ae17b46d898648b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
|