Q. Write a program that reads a text file and then create a new file where each character‘s case is inverted.
Answer =
f1 = open("path.txt","r")
f2 = open("wala.txt","w")
data = f1.readlines()
for i in data :
for j in i :
if j.isupper() :
f2.write(j.lower())
elif j.islower() :
f2.write(j.upper())
else :
f2.write(j)
f1.close()
f2.close()
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )