old_contents: #! /usr/bin/env python
  
  import sys, string, locale
  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(locale.strcoll)
  print string.join(list, '\n')
  
new_contents: #! /usr/bin/env python
  
  import sys, string, locale
  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))
  
subject: Make sort-test.py Python 3 compatible