python工具集
Project description
pxtool
pxtool 是一个Python工具集合,提供了日志处理和JSON文本处理等实用功能。
安装
pip install pxtool
功能特性
1. 日志处理 (set_log)
- 支持彩色控制台输出
- 自动创建日志文件并按日期命名
- 支持自定义日志级别(包括TRACE级别)
- 同时输出到文件和控制台
示例:
from pxtool.set_log import setup_logger
import logging
# 初始化日志配置
setup_logger(log_filename_prefix='myapp', level=logging.INFO)
# 使用日志
logging.debug("调试信息")
logging.info("普通信息")
logging.warning("警告信息")
logging.error("错误信息")
2. JSON处理 (json_deal)
- 移除JSON文本中的Markdown代码块包装
- 支持多种格式的JSON文本清理
示例:
from pxtool.json_deal import remove_json_wrapper
json_text = '''```json
{
"name": "pxtool",
"version": "0.1.0"
}
```'''
cleaned_json = remove_json_wrapper(json_text)
print(cleaned_json)
要求
- Python >= 3.6
- termcolor (用于彩色日志输出)
许可证
MIT License
作者
- 作者:px
- 邮箱:panxin@panxin.me
- 项目地址:https://github.com/pxpy/pxtool
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
pxtool-0.1.0.tar.gz
(2.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pxtool-0.1.0.tar.gz.
File metadata
- Download URL: pxtool-0.1.0.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d4e2fcc89b8be4f5455a74e3e42b186a5060d6476d360d00ca78fdce16a3f0d
|
|
| MD5 |
34ad8bd32c1f10de808f576303bcbb57
|
|
| BLAKE2b-256 |
b13fe093389fb225177d8484a905fca5bc13db1ef5c2540b591ae16f9c34ecf0
|
File details
Details for the file pxtool-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pxtool-0.1.0-py3-none-any.whl
- Upload date:
- Size: 1.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f249bfeb894b2507c7053e36be0b175762ce0371816b8816b92f6673f26051c9
|
|
| MD5 |
6b46a2207c166e88f7361937c023cfa0
|
|
| BLAKE2b-256 |
6b7300f02e8a10337d089ee810df9f5a1496edfae5dba1f79f55c1d34dae89e7
|