Calmcode - pathlib: do not hardcode

Do Not Hardcode

1 2 3 4 5 6 7

The goal of this series of videos is to demonstrate how to deal with files, paths and folders from python programmatically. We'll mainly discuss the python pathlib module.

The code used in this video is listed below.

python code

import json

with open("settings/config.json") as f:
    d = json.loads(f.read())

settings/config.json

{
  "setting": "a",
  "config": "b"
}