我在某个位置有 2 个降价文件,内容是
---
title: test markdown file 1
date: 2020/02/11
---
This is a short one line paragraph.
---
title: test markdown file 2
date: 2020/02/12
---
This is a short 2 line paragraph.
我想解析它们,下面是代码但是我只得到 1 个值作为下面的输出,OUTPUT {'title': 'test markdown file 2', 'date': '2020/02/12'} 这是一个简短的 2行段落。
我怎样才能得到第一个降价文件的内容呢?
import frontmatter,os
path = 'C:/input/'
for entry in os.scandir(path):
print(entry.path)
post = frontmatter.load(entry)
print(post.metadata)
print(post.content)
慕斯709654
相关分类