Skip to content

shubham-369/Text_Analysis_Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Text File Handling in Python

This Python script provides functionality to handle text files, including reading, analyzing, and modifying their content.

Dependencies

  • Python 3.12.2

Usage

  1. Clone or download this repository in your computer.

  2. Open a terminal or command prompt in your vs code or any other editor.

  3. Navigate to the directory where the script is located.

  4. Run the script using the following command: 'python text_analysis.py'

  5. Follow the on-screen instructions to perform text analysis and modification.

File Structure

  • text_analysis.py: The main Python script file.
  • sample.txt: An example text file for testing the script.

Functionality

  • read_txt_file(file_path): Reads content from a text file.
  • analyze_text(text): Performs basic text analysis, including counting words, lines, and characters.
  • modify_text(file_path, old_word, new_word): Modifies the content of a text file by replacing old words with new words.

Example

To replace the word "Python" with "Java" in the sample text file:

  1. Run the script.
  2. Enter "Python" when prompted for the word you want to replace.
  3. Enter "Java" when prompted for the new word.
  4. The modified content will be written back to the sample text file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages