Files
dsProject/dsLightRag/static/YunXiao/WangYouYiLiDingLv/ReadAll.py
2025-08-28 13:46:08 +08:00

22 lines
993 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# markdown文件路径
import os
md_path = r'D:\dsWork\dsProject\dsLightRag\static\YunXiao\WangYouYiLiDingLv'
# 读取此目录下所有markdown文件以文本方式读取即可
for file_name in os.listdir(md_path):
# 如果扩展名是 .md 的有用
if file_name.endswith('.md'):
print("==========================================================")
# 例中等_1.md 输出 中等难度 第1题
print(file_name.split('_')[0] + "难度 第" + file_name.split('_')[1].split('.')[0] + "")
# 读取文件内容
with open(os.path.join(md_path, file_name), 'r', encoding='utf-8') as f:
content = f.read()
content = content.replace('\>', '')
content = content.replace('>', '')
content = content.replace('\\', '')
if content and len(content.strip()) > 0:
print(content)
print("==========================================================")