From 120d759a245248d7ae93d3b8328b0291f4ddcf9b Mon Sep 17 00:00:00 2001 From: pg78ac9nr <2401677463@qq.com> Date: Thu, 19 Sep 2024 00:16:17 +0800 Subject: [PATCH] =?UTF-8?q?Update=20102201214=20=E8=AE=B8=E8=8E=8E?= =?UTF-8?q?=E8=8E=8E.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 102201214 许莎莎.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/102201214 许莎莎.py b/102201214 许莎莎.py index fdeddac..41ca4c0 100644 --- a/102201214 许莎莎.py +++ b/102201214 许莎莎.py @@ -126,7 +126,6 @@ for page in range(1,8): ai_list = [] most_common_barrages = [] - with open('弹幕.txt', 'r', encoding='utf-8') as file: content_txt = file.readlines() for barrage in content_txt: @@ -141,17 +140,14 @@ ai_list1 = counter.most_common() # 输出结果 for barrage, count in most_common_barrages: print(f'弹幕: {barrage} 出现次数: {count}') - df = pd.DataFrame(ai_list1, columns=['弹幕', '出现次数']) # 写入Excel文件 excel_path = '弹幕统计.xlsx' df.to_excel(excel_path, index=False, engine='openpyxl') - wb = load_workbook(excel_path) ws = wb.active - ws.column_dimensions['A'].width = 60 - wb.save(excel_path) - ai_str = '\n'.join(ai_list) #分割成字符型 + # 创建词云图 + #create_wordcloud(ai_danmakus) \ No newline at end of file