A small Python program demonstrating reading a file and performing a simple find-and-replace operation with a menu-driven interface.
- Validate file existence before operations
- Read and display full file content
- Replace all occurrences of a word with another
- Simple, robust error handling
- Python 3.8+
- No external libraries required
python3 file_handling.py
- When prompted, enter the path to an existing text file.
- Choose an option from the menu:
- 1: Read file
- 2: Find and replace word
- 3: Exit
Enter filename: demo.txt
--- File Handling Menu ---
1. Read File
2. Find and Replace Word
3. Exit
Enter your choice: 1
--- File Content ---
(contents shown here)
--------------------
file_handling.py
: Menu and file operationsdemo.txt
: Example file (optional)