Skip to main content

A simple Python package to count words and characters.

Project description

README.md for word-count-package md Copy Edit

📄 Word Count Package (word-count-package)

A simple Python package that counts words & characters in any given text.
Useful for text processing, analytics, and word-based analysis. 🚀


📌 Installation

Install this package using pip:

pip install word-count-package
📌 Importing the Package
Once installed, import it into your Python script:

python
Copy
Edit
import wordcount
📌 Available Functions
🔹 count_words_and_chars(text)
This function counts words and characters in a given text.

📌 Function Signature
python
Copy
Edit
wordcount.count_words_and_chars(text: str) -> dict
📌 Parameters
Parameter	Type	Description
text	str	The input text to analyze
📌 Returns
This function returns a dictionary containing:

"words"  Number of words in the text.
"characters"  Number of characters in the text.
📌 Example Usage
Create a Python script (e.g., test_script.py) and use the package:

python
Copy
Edit
import wordcount

text = "Python packaging is fun and useful!"
result = wordcount.count_words_and_chars(text)

print(f"Words: {result['words']}, Characters: {result['characters']}") Expected Output
yaml
Copy
Edit
Words: 6, Characters: 37
📌 More Examples
python
Copy
Edit
result = wordcount.count_words_and_chars("Hello world!")
print(result)
Output:
python
Copy
Edit
{'words': 2, 'characters': 12}
python
Copy
Edit
result = wordcount.count_words_and_chars("This is a Python package example.")
print(result)
Output:
python
Copy
Edit
{'words': 6, 'characters': 35}
📌 Updating the Package
If a new version is released, upgrade using:

sh
Copy
Edit
pip install --upgrade word-count-package
📌 Supported Environments
✅ Windows (Command Prompt, PowerShell) macOS (Terminal) Linux (Bash, Zsh, etc.)

Works with Python 3.6+.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

word_count_package-1.0.1.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file word_count_package-1.0.1.tar.gz.

File metadata

  • Download URL: word_count_package-1.0.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for word_count_package-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ab55cee9dde136e840c436ff11f059f9a1e369adea2d01bf93413990a376fa0f
MD5 f78bf7af6579644399c48eb605e1e379
BLAKE2b-256 4cfc829d2ebec7fec6b0a3eed805806e3ee0f3c0b042ccacde52de855552dd01

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page