List of file handling exercises
1. Write a python program to create a file and write contents, save and close the file.
2. Write a python program to read file contents and display on console.
3. Write a python program to read numbers from a file and write even, odd and prime
numbers to separate file.
4. Write a python program to append content to a file.
5. Write a python program to compare two files.
6. Write a python program to copy contents from one file to another file.
7. Write a python program to merge two file to third file.
8. Write a python program to count characters, words and lines in a text file.
9. Write a python program to remove a word from text file.
10. Write a python program to remove specific line from a text file.
11. Write a python program to remove empty lines from a text file.
12. Write a python program to find occurrence of a word in a text file.
13. Write a python program to count occurrences of a word in a text file.
14. Write a python program to count occurrences of all words in a text file.
15. Write a python program to find and replace a word in a text file.
16. Write a python program to replace specific line in a text file.
17. Write a python program to print source code of same program.
18. Write a python program to convert uppercase to lowercase character and vice versa in a
text file.
19. Write a python program to find properties of a file using stat() function.
20. Write a python program to check if a file or directory exists.
21. Write a python program to rename a file using rename() function.
22. Write a python program to list all files and sub-directories recursively.