PostgreSQL Source Code  git master
sort-test.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 
3 import locale
4 import sys
5 
6 locale.setlocale(locale.LC_ALL, "")
7 
8 if len(sys.argv) != 2:
9  sys.stderr.write("Usage: sort.py filename\n")
10  sys.exit(1)
11 
12 infile = open(sys.argv[1], 'r')
13 list = infile.readlines()
14 infile.close()
15 
16 for i in range(0, len(list)):
17  list[i] = list[i][:-1] # chop!
18 
19 list.sort(key=locale.strxfrm)
20 print('\n'.join(list))
void print(const void *obj)
Definition: print.c:36
const void size_t len
static struct cvec * range(struct vars *v, chr a, chr b, int cases)
Definition: regc_locale.c:412