Skip to main content

A collection of Python utilities

Project description

zutilities

A collection of Python utilities

Table of Contents

Prerequisites

You'll need to have Python installed in order to use zutilities. Start by downloading and installing Python.

Note: Python 3 is recommended, however zutilities will probably work just fine with most verions of Python 2

Installation

python -m pip install zutilities

Usage

zutilities.jprint(list_or_dict, indent=2)

Prints a list or dictionary as formatted JSON.

>>> zutilities.jprint([{'key1':'value1','key2':'value2'}])
[
  {
    "key1": "value1",
    "key2": "value2"
  }
]

zutilities.read_json_file(json_file)

Reads a JSON file from the filesystem and returns a list or dictionary.

>>> j = zutilities.read_json_file('file.json')
>>> j
[{'key1': 'value1', 'key2': 'value2'}]

zutilities.get_logger(log_level=20, format=default_log_format, streams=[sys.stdout])

Returns a logging.RootLogger object with preferred defaults set. The default_log_format is '[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s'

>>> logr = zutilities.get_logger()
>>> logr.info('Hello World')
[2021-10-08 21:08:40,353] {<stdin>:1} INFO - Hello world

License

This project is licensed under the 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.

Files for zutilities, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size zutilities-0.1.2.tar.gz (3.5 kB) File type Source Python version None Upload date Hashes View
Filename, size zutilities-0.1.2-py2.py3-none-any.whl (3.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page