# text-counter **Repository Path**: lelele166/text-counter ## Basic Information - **Project Name**: text-counter - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-11-02 - **Last Updated**: 2025-11-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 文本统计工具 ## 项目简介 本工具为命令行程序,支持统计纯英文文本的字符、单词、句子数,及代码文件的代码行、空行、注释行。 ## 用法 命令格式:`python wc.py [参数] [文件名]` 支持参数: - `-c`:统计字符数 - `-w`:统计单词数 - `-s`:统计句子数 - `-l`:统计代码行数(Python文件,`#`为注释标识) - `-e`:统计空行数 - `-com`:统计注释行数 示例:`python wc.py -w test.txt` → 统计`test.txt`的单词数。 ## 文件列表 - `wc.py`:主程序,实现所有统计功能。 - `test.txt`:纯英文测试文本。 - `test_code.py`:Python代码测试文件。 - `README.md`:项目说明文档。 ## 例程运行及结果 1. 统计`test.txt`单词数: 命令:`python wc.py -w test.txt` 结果:9 截图:![单词数统计截图](images/test-v0.2.png) 2. 统计`test_code.py`代码行数: 命令:`python wc.py -l test_code.py` 结果:3 截图:![代码行统计截图](images/test-v0.3.png)