summaryrefslogtreecommitdiff
path: root/src/examples/pgn.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/pgn.py
parent6b12041d4656f4cda910f24acda8d71013166fbd (diff)
downloadpyparsing-git-774e46526945ea91265734a2dc82d15eed515577.tar.gz
Clean up examples to be Python 3 compatible
Diffstat (limited to 'src/examples/pgn.py')
-rw-r--r--src/examples/pgn.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/examples/pgn.py b/src/examples/pgn.py
index 8f6574d..c645f73 100644
--- a/src/examples/pgn.py
+++ b/src/examples/pgn.py
@@ -61,10 +61,10 @@ pgnGrammar = Suppress(ZeroOrMore(tag)) + ZeroOrMore(move) + Optional(Suppress(g
def parsePGN( pgn, bnf=pgnGrammar, fn=None ):
try:
return bnf.parseString( pgn )
- 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)
if __name__ == "__main__":
# input string
@@ -91,4 +91,4 @@ Bxe5 Rxe5 21. Rg5 Rxe1# {Black wins} 0-1
"""
# parse input string
tokens = parsePGN(pgn, pgnGrammar)
- print "tokens = ", tokens
+ print("tokens = ", tokens)