You can do, or you can just skip all the spaces and extra quotes and junk and just use literal /.
path = f"{HOME}/cards/{card_id}/card.yaml"
Easier to read & write IMO, and works fine. Even on Windows.