summaryrefslogtreecommitdiff
path: root/src/examples/parseListString.py
diff options
context:
space:
mode:
authorPaul McGuire <ptmcg@austin.rr.com>2012-11-23 08:54:10 +0000
committerPaul McGuire <ptmcg@austin.rr.com>2012-11-23 08:54:10 +0000
commit774e46526945ea91265734a2dc82d15eed515577 (patch)
tree734ae210c20a98f01fe029f7e6eeb7a93b4617fb /src/examples/parseListString.py
parent6b12041d4656f4cda910f24acda8d71013166fbd (diff)
downloadpyparsing-git-774e46526945ea91265734a2dc82d15eed515577.tar.gz
Clean up examples to be Python 3 compatible
Diffstat (limited to 'src/examples/parseListString.py')
-rw-r--r--src/examples/parseListString.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/examples/parseListString.py b/src/examples/parseListString.py
index eb784c7..a6f07a1 100644
--- a/src/examples/parseListString.py
+++ b/src/examples/parseListString.py
@@ -18,7 +18,7 @@ listStr = lbrack + delimitedList(listItem) + rbrack
test = "['a', 100, 3.14]"
-print listStr.parseString(test)
+print(listStr.parseString(test))
# second pass, cleanup and add converters
@@ -35,7 +35,7 @@ listStr = lbrack + delimitedList(listItem) + rbrack
test = "['a', 100, 3.14]"
-print listStr.parseString(test)
+print(listStr.parseString(test))
# third pass, add nested list support, and tuples, too!
cvtInt = lambda s,l,toks: int(toks[0])
@@ -54,7 +54,7 @@ tupleStr.setParseAction( lambda t:tuple(t.asList()) )
listStr << lbrack + delimitedList(listItem) + Optional(Suppress(",")) + rbrack
test = "['a', 100, ('A', [101,102]), 3.14, [ +2.718, 'xyzzy', -1.414] ]"
-print listStr.parseString(test)
+print(listStr.parseString(test))
# fourth pass, just parsing tuples of numbers
#~ from pyparsing import *
@@ -97,4 +97,4 @@ listStr << lbrack + delimitedList(listItem) + Optional(Suppress(",")) + rbrack
dictStr << rbrace + delimitedList( Group( listItem + colon + listItem ) ) + rbrace
test = "['a', 100, ('A', [101,102]), 3.14, [ +2.718, 'xyzzy', -1.414] ]"
test = '[{0: [2], 1: []}, {0: [], 1: [], 2: []}, {0: [1, 2]}]'
-print listStr.parseString(test)
+print(listStr.parseString(test))