Q. Write a function Remove_Lowercase() that accepts two file names, and copies all lines that do not start with lowercase letter from the first file into the second file.


Answer =

def Remove_Lowercase(f1,f2) :
    data = f1.readlines()
    for i in data :
        if i[ 0 ].isupper() :
            f2.write(i + "\n")

f1 = open("python code.txt",'r')
f2 = open("pathwalla.txt",'w')

Remove_Lowercase(f1,f2)
    
f2.close()



Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post