Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Advanced String Formatting for Python >= 2.4.
Python
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
.hgignore
.hgtags
LICENSE
MANIFEST.in
README.rst
setup.py
stringformat.py
stringformat_lite.py
tests.py

README.rst

StringFormat

StringFormat is an independent port of the Python 3 advanced string formatting, compatible with Python >= 2.4. This implementation is pure Python.

Add the method str.format only if it is missing (Python < 2.6):

import stringformat

stringformat.init()

Enable auto-numbering fields ("{} {}" instead of "{0} {1}") with Python 2.6 also:

import sys
import stringformat

if sys.version_info < (2, 7):
    stringformat.init(True)

The advanced string formatting is officially included in the language since Python 2.6.

http://docs.python.org/whatsnew/2.6.html#pep-3101-advanced-string-formatting

Something went wrong with that request. Please try again.