我正在使用
将markdown转换为org#+begin_src ipython :session sql :results output
import glob
import subprocess
mds = glob.glob("*.md")
mds.remove("README.md")
for md in mds:
cmd = f"pandoc --wrap=none {md} -o {md.replace('.md', '.org')}"
print(cmd)
subprocess.run(cmd, shell=True)
#+end_src
#+RESULTS:
#+begin_example
pandoc --wrap=none Lesson 7. Creating Calculated Fields.md -o Lesson 7. Creating Calculated Fields.org
pandoc --wrap=none Lesson 1. Understanding SQL.md -o Lesson 1. Understanding SQL.org
它没有按预期方式工作并找出问题所在:
名称中的单词之间有空格,因此将cmd更改为
cmd = f"pandoc --wrap=none '{md}' -o {md.replace('.md', '.org')}"
用'{md}'封装{md},然后离开{md.replace('.md', '.org')
怎么封装它?