diff --git a/README.rst b/README.rst index 4d58588..cf65bf7 100644 --- a/README.rst +++ b/README.rst @@ -2,8 +2,23 @@ Parse strings using a specification based on the Python format() syntax. parse() is the opposite of format() -The `Format String Syntax`_ is supported with anonymous (fixed-position), -named and formatted fields:: +Basic usage: + +>>> from parse import * # only exports parse() and compile() +>>> parse("It's {}, I love it!", "It's spam, I love it!") + +>>> p = compile("It's {}, I love it!") +>>> print p + +>>> p.parse("It's spam, I love it!") + + + +Format Syntax +------------- + +Most of the `Format String Syntax`_ is supported with anonymous +(fixed-position), named and formatted fields:: {[field name]:[format spec]} @@ -30,6 +45,9 @@ Some simple parse() format string examples: >>> print r.named {'item': 'hand grenade'} +Format Specification +-------------------- + Most of the `Format Specification Mini-Language`_ is supported:: [[fill]align][sign][#][0][width][,][.precision][type] @@ -92,6 +110,7 @@ examples. Run the tests with "python -m parse". **Version history (in brief)**: +- 1.1.2 refactored, added compile() and limited ``from parse import *`` - 1.1.1 documentation improvements - 1.1.0 implemented more of the `Format Specification Mini-Language`_ and removed the restriction on mixing fixed-position and named fields diff --git a/parse.py b/parse.py index 303b525..4787ad5 100644 --- a/parse.py +++ b/parse.py @@ -114,7 +114,7 @@ examples. Run the tests with "python -m parse". **Version history (in brief)**: -- 1.1.2 refactored, added compile() and limited "from parse import *" +- 1.1.2 refactored, added compile() and limited ``from parse import *`` - 1.1.1 documentation improvements - 1.1.0 implemented more of the `Format Specification Mini-Language`_ and removed the restriction on mixing fixed-position and named fields