I am trying to automate the directory map for a Johnny Decimal directory as an R Markdown document. My Python script only returns the top level directory. I do not get the second level down at all.
I have tried using "import pathlib" and "import os". I got further with "import os"
import os
path = "c:\\local\\top"
print("# Johnny Decimal\r\n")
for d1 in filter(os.path.isdir, os.listdir(path)):
path2 = path + "\\" + d1
print("## " + d1 + "\r\n")
for d2 in filter(os.path.isdir, os.listdir(path2)):
print("### " + d2 + "\r\n")
I get:
# Johnny Decimal
## 10
## 20
I expected to get:
# Johnny Decimal
## 10
### 11
### 12
## 20
### 21
### 22