Skip to content

Commit c954b79

Browse files
authored
Merge pull request #489 from cclauss/patch-3
Use print() function in both Python 2 and Python 3
2 parents 7efd55d + 6ff061e commit c954b79

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

docs/other/find_pattern.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
Larger snippets can be placed in a file (as opposed to a command-line
3939
arg) and processed with the -f option.
4040
"""
41+
from __future__ import print_function
4142

4243
__author__ = "Collin Winter <[email protected]>"
4344

@@ -65,7 +66,7 @@ def main(args):
6566
elif len(args) > 1:
6667
tree = driver.parse_stream(StringIO(args[1] + "\n"))
6768
else:
68-
print >>sys.stderr, "You must specify an input file or an input string"
69+
print("You must specify an input file or an input string", file=sys.stderr)
6970
return 1
7071

7172
examine_tree(tree)
@@ -75,10 +76,10 @@ def examine_tree(tree):
7576
for node in tree.post_order():
7677
if isinstance(node, pytree.Leaf):
7778
continue
78-
print repr(str(node))
79+
print(repr(str(node)))
7980
verdict = raw_input()
8081
if verdict.strip():
81-
print find_pattern(node)
82+
print(find_pattern(node))
8283
return
8384

8485
def find_pattern(node):

0 commit comments

Comments
 (0)