Skip to main content

python工具集

Project description

pxtool

pxtool 是一个Python工具集合,提供了日志处理和JSON文本处理等实用功能。

安装

pip install pxtool

功能特性

1. 日志处理 (set_log)

  • 支持彩色控制台输出
  • 自动创建日志文件并按日期命名
  • 支持自定义日志级别(包括TRACE级别)
  • 同时输出到文件和控制台

示例:

from pxtool 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 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

作者

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.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pxtool-0.1.2-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file pxtool-0.1.2.tar.gz.

File metadata

  • Download URL: pxtool-0.1.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for pxtool-0.1.2.tar.gz
Algorithm Hash digest
SHA256 07e5e2d36dce2f6b9ddc2b2916a0242352c37db59444370d03204bfe623dc8bf
MD5 0cac64eb25c21d577a60442e05ae4e2e
BLAKE2b-256 d4cf27f85e559ac8f401094574f3958a9df705bf3b8a318c4eaaa206849b411f

See more details on using hashes here.

File details

Details for the file pxtool-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pxtool-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for pxtool-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2822ef1dd91eea33e595af65c75fcddf6f5de55fd61b333ef69a2bbfa85db01a
MD5 a6e1a0386d39d99c70821d23ebd26868
BLAKE2b-256 d93ccf2dbb3691c7b7b582bc83a0f1d4b7e2bc490562780b4cf7a9c8743256f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page