Make sort-test.py Python 3 compatible

Python 2 is still supported.
This commit is contained in:
Peter Eisentraut 2019-01-04 11:23:24 +01:00
parent 3d59da9ccd
commit cb719fa02d
1 changed files with 3 additions and 3 deletions

View File

@ -3,7 +3,7 @@
import sys, string, locale
locale.setlocale(locale.LC_ALL, "")
if len(sys.argv) <> 2:
if len(sys.argv) != 2:
sys.stderr.write("Usage: sort.py filename\n")
sys.exit(1)
@ -14,5 +14,5 @@ infile.close()
for i in range(0, len(list)):
list[i] = list[i][:-1] # chop!
list.sort(locale.strcoll)
print string.join(list, '\n')
list.sort(key=locale.strxfrm)
print('\n'.join(list))