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


Answer :-


def remove_lowercase (infile, outfile) :
    output = file(outfile, "w")
    for line in file (infile) :
        if not line [0] in "abcdefghijklmnopqrstuvwxyz" :
            output.write(line)
    output.close()

Post a Comment

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

Previous Post Next Post