summaryrefslogtreecommitdiffstats
path: root/src/test/locale/sort-test.py
blob: 21d6e78eb54d83a571323636d9191580f154ef4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#! /usr/bin/env python

import locale
import sys

locale.setlocale(locale.LC_ALL, "")

if len(sys.argv) != 2:
    sys.stderr.write("Usage: sort.py filename\n")
    sys.exit(1)

infile = open(sys.argv[1], 'r')
list = infile.readlines()
infile.close()

for i in range(0, len(list)):
    list[i] = list[i][:-1]  # chop!

list.sort(key=locale.strxfrm)
print('\n'.join(list))