def copy_file(in_name, out_name): in_file = open(in_name, "r") out_file = open(out_name, "w") for line in in_file: # note: the end="" argument in the next line ensures that # print will not insert an extra line at the end. print(line, file=out_file, end="") in_file.close() out_file.close() def main(): copy_file("hello2.txt", "hello3.txt") print("done converting to upper case") main()