summaryrefslogtreecommitdiff
path: root/src/examples/linenoExample.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/linenoExample.py
parent6b12041d4656f4cda910f24acda8d71013166fbd (diff)
downloadpyparsing-git-774e46526945ea91265734a2dc82d15eed515577.tar.gz
Clean up examples to be Python 3 compatible
Diffstat (limited to 'src/examples/linenoExample.py')
-rw-r--r--src/examples/linenoExample.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/examples/linenoExample.py b/src/examples/linenoExample.py
index 751822c..1186f48 100644
--- a/src/examples/linenoExample.py
+++ b/src/examples/linenoExample.py
@@ -18,11 +18,11 @@ of their country."""
def reportLongWords(st,locn,toks):
word = toks[0]
if len(word) > 3:
- print "Found '%s' on line %d at column %d" % (word, lineno(locn,st), col(locn,st))
- print "The full line of text was:"
- print "'%s'" % line(locn,st)
- print (" "*col(locn,st))+" ^"
- print
+ print("Found '%s' on line %d at column %d" % (word, lineno(locn,st), col(locn,st)))
+ print("The full line of text was:")
+ print("'%s'" % line(locn,st))
+ print((" "*col(locn,st))+" ^")
+ print()
wd = Word(alphas).setParseAction( reportLongWords )
OneOrMore(wd).parseString(data)
@@ -46,4 +46,4 @@ def createTokenObject(st,locn,toks):
wd = Word(alphas).setParseAction( createTokenObject )
for tokenObj in OneOrMore(wd).parseString(data):
- print tokenObj
+ print(tokenObj)