diff options
author | Paul McGuire <ptmcg@austin.rr.com> | 2014-10-11 05:11:47 +0000 |
---|---|---|
committer | Paul McGuire <ptmcg@austin.rr.com> | 2014-10-11 05:11:47 +0000 |
commit | 169c544d9eef11444648714530df1050a40b4d9b (patch) | |
tree | a92d1f91004eecc97cfcf81c1d9f0c9968d3057f /src/examples/parsePythonValue.py | |
parent | b6bb2dfea7d97d013c4b69bd3b44d40daa45d792 (diff) | |
download | pyparsing-git-169c544d9eef11444648714530df1050a40b4d9b.tar.gz |
Minor mods to released examples
Diffstat (limited to 'src/examples/parsePythonValue.py')
-rw-r--r-- | src/examples/parsePythonValue.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/examples/parsePythonValue.py b/src/examples/parsePythonValue.py index 1a9cd99..53c61fc 100644 --- a/src/examples/parsePythonValue.py +++ b/src/examples/parsePythonValue.py @@ -2,9 +2,10 @@ #
# Copyright, 2006, by Paul McGuire
#
-
+from __future__ import print_function
from pyparsing import *
+
cvtBool = lambda t:t[0]=='True'
cvtInt = lambda toks: int(toks[0])
cvtReal = lambda toks: float(toks[0])
@@ -40,7 +41,7 @@ tupleStr.setParseAction( cvtTuple ) listStr << (lbrack + Optional(delimitedList(listItem) +
Optional(Suppress(","))) + rbrack)
-listStr.setParseAction( cvtList, lambda t: t[0] )
+listStr.setParseAction(cvtList, lambda t: t[0])
dictEntry = Group( listItem + colon + listItem )
dictStr << (lbrace + Optional(delimitedList(dictEntry) + \
|