Skip to content

Swansea1234/Python-File-Challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Python-File-Challenge

A Python program that demonstrates file reading, writing, and robust error handling by splitting the application logic across multiple modules.

Overview This project is a solution to the "File Read & Write Challenge." It showcases a professional approach to code organization by separating different functionalities into distinct files:

main.py: The entry point of the program, handling all user interaction and orchestrating the file operations. It is responsible for gracefully handling potential errors.

file_handler.py: Contains reusable functions for low-level file operations, such as reading content from a file and writing content to a file.

text_modifier.py: Holds the business logic for modifying the text content, making it a modular component that can be easily changed or replaced.

How to Use To run this program, follow these steps:

Save the files: Ensure that all three Python files (main.py, file_handler.py, and text_modifier.py) are saved in the same folder.

Create an input file: In the same folder, create a simple text file (e.g., input.txt) and add some text to it.

Run the script: Open a terminal or command prompt, navigate to the folder where you saved the files, and execute the following command:

python main.py

Follow the prompts: The program will ask you for the name of the file you want to read. Type the name of the file you created (e.g., input.txt) and press Enter.

The program will then create a new file named modified_input.txt (or whatever your input filename was) containing the modified text.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages