An open API service indexing awesome lists of open source software.

https://github.com/blackcoder56/word_counter

In python3
https://github.com/blackcoder56/word_counter

Last synced: 12 months ago
JSON representation

In python3

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