Skip to main content

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

作者

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.1.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.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pxtool-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 c4c82ac35a349c13aad1e8285c456a3dc5e014eedfd3904f09fe8b64c5cc5ca5
MD5 a6726fc6fdaac86950ba5d33e1a088ab
BLAKE2b-256 2a638edf9a4a588a29db55f4ef250d5b405093fb3fdfa8825bbfa87b4a8f3564

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pxtool-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8ea48ccad3abad1ee8152cdbd946a1825c942da5a79aadfd86d57a60a1cc41e8
MD5 ba869f2045a76398a1e118de0a7240af
BLAKE2b-256 f11804cc0e284bebe23152abcb77668b9bc54b61fb03f75fa03655542eb63522

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