Skip to content

Mahesh2552/Basic-File-Handling-in-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Basic File Handling (CLI)

A small Python program demonstrating reading a file and performing a simple find-and-replace operation with a menu-driven interface.

Features

  • Validate file existence before operations
  • Read and display full file content
  • Replace all occurrences of a word with another
  • Simple, robust error handling

Requirements

  • Python 3.8+
  • No external libraries required

Run

python3 file_handling.py

Usage

  1. When prompted, enter the path to an existing text file.
  2. Choose an option from the menu:
    • 1: Read file
    • 2: Find and replace word
    • 3: Exit

Example Session

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)
--------------------

Project Structure

  • file_handling.py: Menu and file operations
  • demo.txt: Example file (optional)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages