How do I read a file in Python and write its contents to another file with the following condition:
If the character is a letter in the input file, then the letter should be made lowercase and written to the output file. Other characters should not be written.
def lower_case():
file_name = input("Enter the file name to read from: ")
tmp_read = open(str(file_name), 'r')
tmp_read.readline()
fileName = input("Enter the file name to write to... ")
tmp_write = open(str(fileName), "w")
for line in tmp_read:
if str(line).isalpha():
tmp_write.write(str(line).lower())
print("Successful!")
if __name__ == "__main__":
lower_case()