一键合并多个Markdown文档
一键合并多个Markdown文档
将你需要合并的md文档放在一个文件夹下
import os
path = "md文档所在文件夹的绝对路径"
md_list = os.listdir(path)
contents = []
for md in md_list:
md_file = path + '//' + md
with open(md_file, 'r', encoding='utf-8') as file:
contents.append(file.read() + "/n")
with open("xxx.md", "w", encoding='utf-8') as file:
file.writelines(contents)
共有 0 条评论