logo

... pathlib: making folders



Notes

The code that handles all the creation of files and folders is listed below.

for i in range(10):
  for j in range(5): 
      p = Path("data", f"folder-{i}", f"file-{j}.json")
      if not p.parent.exists():
          p.parent.mkdir()
          p.write_text(create_json(i * j))

Feedback? See an issue? Something unclear? Feel free to mention it here.



If you want to be kept up to date, consider signing up for the newsletter.