summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkms70847 <kms70847@users.noreply.github.com>2019-08-13 06:17:55 -0400
committerPaul McGuire <ptmcg@users.noreply.github.com>2019-08-13 05:17:55 -0500
commit2c6f881943ecf0fbf02354623b51cc0566325c75 (patch)
tree5fecabf0dc32b17c963effd2f24ed2ac663d35bf
parente115e882361701a91d78ca6ef1cd90d6a5adfd43 (diff)
downloadpyparsing-git-2c6f881943ecf0fbf02354623b51cc0566325c75.tar.gz
3.x-ify some print statements and an except (#114)
Thanks, and nice catch on the except statement too!
-rw-r--r--docs/HowToUsePyparsing.rst10
1 files changed, 5 insertions, 5 deletions
diff --git a/docs/HowToUsePyparsing.rst b/docs/HowToUsePyparsing.rst
index e3d67e2..ce954f2 100644
--- a/docs/HowToUsePyparsing.rst
+++ b/docs/HowToUsePyparsing.rst
@@ -59,7 +59,7 @@ or any other greeting of the form "<salutation>, <addressee>!"::
greet = Word(alphas) + "," + Word(alphas) + "!"
greeting = greet.parseString("Hello, World!")
- print greeting
+ print(greeting)
The parsed tokens are returned in the following form::
@@ -691,10 +691,10 @@ Exception classes and Troubleshooting
ParseExceptions have attributes loc, msg, line, lineno, and column; to view the
text line and location where the reported ParseException occurs, use::
- except ParseException, err:
- print err.line
- print " " * (err.column - 1) + "^"
- print err
+ except ParseException as err:
+ print(err.line)
+ print(" " * (err.column - 1) + "^")
+ print(err)
- ``RecursiveGrammarException`` - exception returned by ``validate()`` if
the grammar contains a recursive infinite loop, such as::