My input file in.txt looked like that:
This is a test for March Madness 2010!
The idea is absolutely cool!
After run the mmc02.py, my out.txt looked like that:
THIS IS A TEST FOR MARCH MADNESS 2010!
THE IDEA IS ABSOLUTELY COOL!
1 #! /usr/bin/python
2
3 import os
4 import sys
5
6 print '***** MMC02 *****'
7
8 if os.path.isfile(sys.argv[2]):
9 os.remove(sys.argv[2])
10
11 try:
12 inFile = file(sys.argv[1], 'r')
13 outFile = file(sys.argv[2], 'w')
14 except:
15 inFile = None
16 outfile = None
17
18 if inFile and outFile:
19 for line in inFile:
20 outFile.write(line.upper())
21 print line.upper()
22
No comments:
Post a Comment