Skip to main content
Help us improve Python packaging – donate today!

Literal string formatting for Python versions older than 3.6

Project Description

Build Status Coverage Status

Formatizer Logo

Awesome artwork provided courtesy of Open Clip Art Library

Formatizer provides literal string formatting for Python versions older than 3.6. This replaces the need for substitution using % or the format function.

Formatizer is covered by unit tests and Flake8 compliance. Please note that this library does use eval to perform its expression processing.

Quick Start

Install Formatizer in your virtualenv as follows:

pip install formatizer

And now, go ahead and use the f function similarly to PEP 498:

from __future__ import print_function
from formatizer import f

GREETING = 'hi'

def main():
    name = 'Fotis'
    print(f('My name is {name}, I say {GREETING} and 1 + 2 is {1 + 2}'))

if __name__ == '__main__':
    main()

All local and global variables will be recognised by the f function and complete Python expressions are also allowed between the braces much like Python 3.6.

Release history Release notifications

This version
History Node

0.1.1

History Node

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
formatizer-0.1.1.tar.gz (3.7 kB) Copy SHA256 hash SHA256 Source None May 31, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page