asap python:
Write a function called fileCaseSwap that takes 2 filenames (strings) as input parameters. The function should:
test call: fileCaseSwap("emma-short.txt", "emma-short-swap.txt") fileCaseSwap("emma.txt", "emma-swap.txt") """ """ The first 3 lines of the emma-short-swap.txt file should be emma bY jANE aUSTEN
code.py
def fileCaseSwap(fname1,fname2):
f=open(fname1,"r")
str=f.read().swapcase()
f.close()
f=open(fname2,"w")
f.write(str)
f.close()
fileCaseSwap("emma-short.txt","emma-short-swap.txt")
--------------------------------------------------------------------------------------
emma-short.txt
EMMA
By Jane Austen
--------------------------------------------------------------------------------------
emma-short-swap.txt
emma
bY jANE aUSTEN
--------------------------------------------------------------------------------------
Get Answers For Free
Most questions answered within 1 hours.