Question: modify fileUpper.py to write the upper case contents string to a new file rather than printing it. Have the name of the new file be
modify fileUpper.py to write the upper case contents string to a new file rather than printing it. Have the name of the new file be dynamically derived from the old name by prepending UPPER to the name. For example, if the user specified the file sample.txt (from above), the program would create a file UPPERsample.txt, containing MY FIRST OUTPUT FILE!. When the user specifies the file name stuff.txt, the resulting file would be named UPPERstuff.txt.
Here is fileUpper.py:
filename = input("Enter a file name: ") fh = open(filename) for i in fh: i = i.rstrip().upper() print (i)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
