summaryrefslogtreecommitdiffstats
path: root/Demo/comparisons
diff options
context:
space:
mode:
Diffstat (limited to 'Demo/comparisons')
-rwxr-xr-xDemo/comparisons/regextest.py6
-rwxr-xr-xDemo/comparisons/sortingtest.py6
-rwxr-xr-xDemo/comparisons/systemtest.py14
3 files changed, 13 insertions, 13 deletions
diff --git a/Demo/comparisons/regextest.py b/Demo/comparisons/regextest.py
index 1fab052..d2c534d 100755
--- a/Demo/comparisons/regextest.py
+++ b/Demo/comparisons/regextest.py
@@ -21,7 +21,7 @@ import sys
import re
def main():
- pats = map(chomp, sys.stdin.readlines())
+ pats = list(map(chomp, sys.stdin.readlines()))
bigpat = '(' + '|'.join(pats) + ')'
prog = re.compile(bigpat)
@@ -29,7 +29,7 @@ def main():
try:
fp = open(file, 'r')
except IOError as msg:
- print "%s: %s" % (file, msg)
+ print("%s: %s" % (file, msg))
continue
lineno = 0
while 1:
@@ -38,7 +38,7 @@ def main():
break
lineno = lineno + 1
if prog.search(line):
- print "%s:%s:%s" % (file, lineno, line),
+ print("%s:%s:%s" % (file, lineno, line), end=' ')
def chomp(s):
return s.rstrip('\n')
diff --git a/Demo/comparisons/sortingtest.py b/Demo/comparisons/sortingtest.py
index cabf626..464eb5c 100755
--- a/Demo/comparisons/sortingtest.py
+++ b/Demo/comparisons/sortingtest.py
@@ -42,10 +42,10 @@ def main():
if not line:
break
items = line.split()
- items = map(makekey, items)
+ items = list(map(makekey, items))
items.sort()
for num, var in items:
- print "%s=%s" % (var, num),
- print
+ print("%s=%s" % (var, num), end=' ')
+ print()
main()
diff --git a/Demo/comparisons/systemtest.py b/Demo/comparisons/systemtest.py
index d3fc72b..e3d840e 100755
--- a/Demo/comparisons/systemtest.py
+++ b/Demo/comparisons/systemtest.py
@@ -25,7 +25,7 @@ def main():
# Note: can't test for presence of lstat -- it's always there
dummy = os.readlink
except AttributeError:
- print "This system doesn't have symbolic links"
+ print("This system doesn't have symbolic links")
sys.exit(0)
if sys.argv[1:]:
prefix = sys.argv[1]
@@ -42,7 +42,7 @@ def reportboguslinks(prefix):
try:
names = os.listdir('.')
except os.error as msg:
- print "%s%s: can't list: %s" % (prefix, '.', msg)
+ print("%s%s: can't list: %s" % (prefix, '.', msg))
return
names.sort()
for name in names:
@@ -51,20 +51,20 @@ def reportboguslinks(prefix):
try:
mode = os.lstat(name)[ST_MODE]
except os.error:
- print "%s%s: can't stat: %s" % (prefix, name, msg)
+ print("%s%s: can't stat: %s" % (prefix, name, msg))
continue
if S_ISLNK(mode):
try:
os.stat(name)
except os.error:
- print "%s%s -> %s" % \
- (prefix, name, os.readlink(name))
+ print("%s%s -> %s" % \
+ (prefix, name, os.readlink(name)))
elif S_ISDIR(mode):
try:
os.chdir(name)
except os.error as msg:
- print "%s%s: can't chdir: %s" % \
- (prefix, name, msg)
+ print("%s%s: can't chdir: %s" % \
+ (prefix, name, msg))
continue
try:
reportboguslinks(prefix + name + '/')