htutil
HaoTian's Python Util
Install
pip install htutil
Usage
file
from htutil import file
Refer to C# System.IO.File API, very simple to use.
s = 'hello'
write_text('1.txt', s)
# hello in 1.txt
append_text('1.txt', 'world')
# helloworld in 1.txt
s = read_text('1.txt')
print(s) # helloworld
s = ['hello', 'world']
write_lines('1.txt', s)
# hello\nworld in 1.txt
append_lines('1.txt',['\npython'])
# hello\nworld\npython in 1.txt
s = read_lines('1.txt')
print(s) # ['hello', 'world', 'python']
cache
cache def result by pickle file.
from htutil import cache
@cache.file_cache
def get_1():
time.sleep(3)
return 1
counter
a simple counter based on dict.
c = Counter()
c.add('1')
c.add('1')
c.add('2')
print(c.to_dict()) # {'1': 2, '2': 1}
c.dump() # same as print(c.to_dict())
Metadata
Release files for htutil 3.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| htutil-3.2.0.tar.gz | 15.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| htutil-3.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.0 kB
Release files / htutil-3.2.0.tar.gz
| Download URL | htutil-3.2.0.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e56da9d5c8d8b45d60536e8b872246b902873370fd10a3009bfee2f4727c6855
|
|
BLAKE2b-256 checksum How to use checksums |
9f08d7a298cb5b3f2555fc8ec55c7b828abf88bb1d4325f466175252a79f8385
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / htutil-3.2.0-py3-none-any.whl
| Download URL | htutil-3.2.0-py3-none-any.whl |
|---|---|
| Size | 16.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
601306ca12693e366fa6274e0a48329fdde3c329996ead422eb8ecf1d0fbca4d
|
|
BLAKE2b-256 checksum How to use checksums |
415b9615adc3021c8f0bf7b602778242160863a1f61b135d2b99041db453aa88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|