Skip to main content

zeroinger

提升编码效率,有效延长程序猿寿命的小工具集

目录

  • 安装
    • 依赖条件
    • pip3安装
  • 使用方法
    • 时间相关
    • Excel/CSV读写
    • 配置文件读取
    • 文本文件读写
  • 更新日志

安装

依赖条件

  • python>=3.6.0
  • logzero==1.5.0

pip3安装

pip3 install --upgrade zeroinger

使用方法

时间相关

StopWatch

from zeroinger.time.stopwatch import StopWatch
import time
# 创建实例
timer = StopWatch.create_instance()
time.sleep(1)
# 获取从开始到现在的耗时
print('当前耗时',timer.duration())
# 添加一个计时快照
cost = timer.add_snapshot()
print('快照1时间点', cost)
time.sleep(1)
cost = timer.add_snapshot()
print('快照2时间点', cost)
snapshot_list = timer.list_snapshot()
print('所有快照时间点', snapshot_list)
# 重置计时器
timer.reset()
#--------------------------------
当前耗时 1004
快照1时间点 1005
快照2时间点 2006
所有快照时间点 [1005, 2006]

Excel/CSV相关

XLSX

读取excel
from zeroinger.excel.xlsx import XLSX
test_read_file_path = os.path.join(os.path.dirname(__file__), 'read_test_file.xlsx')
data = XLSX.read_dict_sheet(test_read_file_path, 0)
print(data)
#--------------
[{'列1': 1, '列2': 4, '列3': 7}, {'列1': 2, '列2': 5, '列3': 8}, {'列1': 3, '列2': 6, '列3': 9}]
写入excel
from zeroinger.excel.xlsx import XLSX
golden = [{'列1': 1, '列2': 4, '列3': 7}, {'列1': 2, '列2': 5, '列3': 8}, {'列1': 3, '列2': 6, '列3': 9}]
test_write_file_path = os.path.join(os.path.dirname(__file__), 'write_test_file.xlsx')
XLSX.write_dict_sheet(test_write_file_path, golden)

压缩文件读写

更新日志

  • 2020/01/06 新增压缩文件读取方法

Metadata

Release files for zeroinger 1.2.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zeroinger 1.2.8
File Size Uploaded
zeroinger-1.2.8.tar.gz 3.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for zeroinger 1.2.8
File Interpreter ABI Platform
zeroinger-1.2.8-py3-none-any.whl Python 3 none any Details

Total release size: 6.0 MB

Release files / zeroinger-1.2.8.tar.gz

Download URL zeroinger-1.2.8.tar.gz
Size 3.0 MB
Tags Source
SHA-256 checksum
How to use checksums
09acf1c9bde8c64a7c888e4a32fe93b6ff58f6c388866daec3e6467a5a1bb6b4
BLAKE2b-256 checksum
How to use checksums
8fa50a75ca9feefb4f7cd011dd0be7bde3aa085c0b05e4db2f8b99063e071284
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.8.2

Release files / zeroinger-1.2.8-py3-none-any.whl

Download URL zeroinger-1.2.8-py3-none-any.whl
Size 3.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
510f8c7c2b0496878d304fcef57e12b525ca1ca3c2ce53a5fea5cf75c373bed4
BLAKE2b-256 checksum
How to use checksums
fe1fb8b6f71dd6b898f340881463e853c7e0a123f06f2369ad3781ba510eeb5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

1.2.8 This release

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.11

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page