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