Skip to main content

PyPI version License: MIT Downloads LinkedIn

whitespace_normalizer

whitespace_normalizer is a Python package designed to clean and standardize whitespace within text. It collapses multiple spaces and tabs into single spaces on each line, trims trailing whitespace, and removes entirely blank lines.

Installation

To install whitespace_normalizer, use pip:

pip install whitespace_normalizer

Usage

Using whitespace_normalizer is straightforward. Import the normalize_whitespace function and pass your string to it.

from whitespace_normalizer import normalize_whitespace

text_with_messy_whitespace = """
This is a   string   with
extra     spaces.

And some
trailing whitespace.   
"""

cleaned_text = normalize_whitespace(text_with_messy_whitespace)
print(cleaned_text)

This will output:

This is a string with
extra spaces.
And some
trailing whitespace.

Features

  • Collapses consecutive spaces and tabs into a single space per line.
  • Removes trailing whitespace from each line.
  • Eliminates empty lines from the text.

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

License

whitespace_normalizer is licensed under the MIT License.

Author

Eugene Evstafev

  • LinkedIn: LinkedIn

Repository

https://github.com/chigwell/whitespace_normalizer

Metadata

Release files for whitespace-normalizer 2025.9.14911

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for whitespace-normalizer 2025.9.14911
File Size Uploaded
whitespace_normalizer-2025.9.14911.tar.gz 2.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for whitespace-normalizer 2025.9.14911
File Interpreter ABI Platform
whitespace_normalizer-2025.9.14911-py3-none-any.whl Python 3 none any Details

Total release size: 5.2 kB

Release files / whitespace_normalizer-2025.9.14911.tar.gz

Download URL whitespace_normalizer-2025.9.14911.tar.gz
Size 2.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6c315a498372ed4b02788f9ce4ee5da62bc326b54f37be9364bc0995354278bf
BLAKE2b-256 checksum
How to use checksums
ed7af0ec88c28ebbce0cc1013d1bf805b3e53f4b80cc42ce621749fb49912b6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release files / whitespace_normalizer-2025.9.14911-py3-none-any.whl

Download URL whitespace_normalizer-2025.9.14911-py3-none-any.whl
Size 2.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe279fb6436200885ba3cb1601dadd88ea2a0009964f7dfa932b44f09ec3a9f7
BLAKE2b-256 checksum
How to use checksums
3b92e5928389ff0fb109ecf6b7a24cd1864fcfe7caeac9e30d914ae2cfb972a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release history Release notifications | RSS feed

This release

2025.9.14911 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page