# 字符串统计 **Repository Path**: highFiveSzu/string_statistics ## Basic Information - **Project Name**: 字符串统计 - **Description**: 统计给定字符所有组合出现的次数 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-08-06 - **Last Updated**: 2020-12-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 字符串统计 count.py 功能实现代码,包含: # 1.读取文件内容,包括.txt.gz getFile(file_path, length) # 2.遍历文件,统计文件中所有种类的字符 getCharType(f) # 3.给定长度,计算给定字符和长度的所有组合 getStrType(chartype, length) # 4.统计每种字符的组合在文件中出现的次数 calStrNum(f, combinations, length) # 5.将统计结果绘制成柱状图 main.py 程序入口,通过命令行传参 main.py -f -l or: main.py --filepath= --length= 注:需安装openpyxl库用于写入excel文件,安装命令 pip install openpyxl - excel文件保存在统计文件的目录下