https://github.com/blackcoder56/word_counter
In python3
https://github.com/blackcoder56/word_counter
Last synced: 12 months ago
JSON representation
In python3
- Host: GitHub
- URL: https://github.com/blackcoder56/word_counter
- Owner: BlackCoder56
- Created: 2025-04-15T14:01:44.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-15T14:28:04.000Z (about 1 year ago)
- Last Synced: 2025-04-15T15:29:48.844Z (about 1 year ago)
- Language: Python
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 📝 Word Counter Script
This is a simple Python script that counts the number of words in a given text file.
## 📌 Features
Prompts the user to enter a file name.
Checks if the file exists before reading.
Reads the file content and counts the total number of words.
Handles missing files gracefully without crashing.
## 🛠️ Requirements
Python 3.x
## 🚀 How to Use
Save the script as word_counter.py.
Run the script:
```bash
python3 word_counter.py
```
***Enter the name of the file you want to analyze (make sure it's in the same directory or provide the full path).***
The script will display the number of words in the file.
## 📂 Example
```bash
Enter file name: sample.txt
```
**Output**
There are 120 words in sample.txt file.
## ⚠️ Notes
If the file does not exist, the script will print:
**Output**
File doesnot exist