A Python implementation of the Unix wc command line utility
Find a file
Sven Van Caekenberghe f096137141
All checks were successful
Python CI / Build and test (push) Successful in 1m37s
Use official uv installer instead of pip
2026-05-30 19:14:02 +02:00
.forgejo/workflows Use official uv installer instead of pip 2026-05-30 19:14:02 +02:00
tests Refactor count_file to accept file object, add pytest test suite 2026-05-30 17:07:12 +02:00
.gitignore Initial commit 2026-05-30 14:46:44 +00:00
.python-version uv init 2026-05-30 16:49:59 +02:00
LICENSE Initial commit 2026-05-30 14:46:44 +00:00
main.py Fix CI 2026-05-30 19:03:48 +02:00
pyproject.toml Refactor count_file to accept file object, add pytest test suite 2026-05-30 17:07:12 +02:00
README.md Refactor count_file to accept file object, add pytest test suite 2026-05-30 17:07:12 +02:00
uv.lock Refactor count_file to accept file object, add pytest test suite 2026-05-30 17:07:12 +02:00

wc

A Python implementation of the Unix wc command line utility.

Usage

# Run directly
python main.py [file ...]

# Or with uv
uv run wc [file ...]

# Or install and run
uv pip install -e .
wc [file ...]

Options

Flag Description
-l Print newline counts
-w Print word counts
-c Print byte counts
-m Print character counts
-L Print maximum line length

Default (no flags): -l -w -c.

Tests

uv run pytest tests/

Reference

https://en.wikipedia.org/wiki/Wc_(Unix)