Open Chinese Convert
0.4.3
A project for conversion between Traditional and Simplified Chinese
|
00001 #!/usr/bin/env python 00002 #coding: utf-8 00003 import sys 00004 from common import sort_items 00005 00006 if len(sys.argv) < 4: 00007 print "Merge and sort all text dictionaries" 00008 print "Usage: ", sys.argv[0], "[input1] [input2] … [inputN] [output]" 00009 exit(1) 00010 00011 all_lines = [] 00012 for i in range(1, len(sys.argv) - 1): 00013 input_file = open(sys.argv[i], "r") 00014 for line in input_file: 00015 all_lines += line 00016 input_file.close() 00017 all_lines += '\n' 00018 00019 output_filename = sys.argv[-1] 00020 output_file = open(output_filename, "w") 00021 for line in all_lines: 00022 output_file.write(line) 00023 output_file.close() 00024 00025 sort_items(output_filename, output_filename)