Simply write input file to output file

This commit is contained in:
JSCHILL1 2009-04-03 19:45:16 -05:00
parent 2ebe648546
commit 713228b6c0

View file

@ -22,7 +22,6 @@
# TODOs: # TODOs:
# #
# 5) Copy input file text to output file text
# 6) Read input file into memory using an XML library # 6) Read input file into memory using an XML library
# 7) Implement a function that will remove all unreferenced id attributes from # 7) Implement a function that will remove all unreferenced id attributes from
# from an SVG document (xlink:href="#someid", fill="url(#someid)", etc) # from an SVG document (xlink:href="#someid", fill="url(#someid)", etc)
@ -48,11 +47,13 @@ if( len(args) != 4 ):
infile = '' infile = ''
outfile = '' outfile = ''
# Get input file
if( args[0] == '-i' ): if( args[0] == '-i' ):
infile = args[1] infile = args[1]
elif( args[2] == '-i' ): elif( args[2] == '-i' ):
infile = args[3] infile = args[3]
# Get output file
if( args[0] == '-o' ): if( args[0] == '-o' ):
outfile = args[1] outfile = args[1]
elif(args[2] == '-o' ): elif(args[2] == '-o' ):
@ -66,8 +67,13 @@ if( outfile == '' ):
print 'Error! -o argument is missing' print 'Error! -o argument is missing'
quit() quit()
# Open input file for reading, throws error if file does not exist
input = open(infile, 'r') input = open(infile, 'r')
# Open output file for writing, overwriting file if necessary
output = open(outfile, 'w') output = open(outfile, 'w')
output.write(input.read());
# Close input and output files
input.close() input.close()
output.close() output.close()