Python Practice › File Handling Programs › Program 12
Copy a file in lowercase
Write a Python program to copy a file’s contents to another file in lowercase.
Output
hello world python files
Approach
- Read,
lower(), write.
Solution
with open("in.txt", "w") as f: f.write("Hello World\nPYTHON Files\n") with open("in.txt") as src, open("lower.txt", "w") as dst: dst.write(src.read().lower())print(open("lower.txt").read())Output
hello world python files
Learn the concept
New to this topic? Read the lesson, then come back.