Header And Logo

PostgreSQL
| The world's most advanced open source database.

sort-test.py

Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 
00003 import sys, string, locale
00004 locale.setlocale(locale.LC_ALL, "")
00005 
00006 if len(sys.argv) <> 2:
00007    sys.stderr.write("Usage: sort.py filename\n")
00008    sys.exit(1)
00009 
00010 infile = open(sys.argv[1], 'r')
00011 list = infile.readlines()
00012 infile.close()
00013 
00014 for i in range(0, len(list)):
00015    list[i] = list[i][:-1] # chop!
00016 
00017 list.sort(locale.strcoll)
00018 print string.join(list, '\n')