Skip to navigation
Example check and read a file with pythons pathlib
09.07.25
# Check if a JSON file exists, and when it exists read it and convert its JSON string to a python object with pathlib ```python import json from pathlib import Path p = Path("db/page.json") if p.is_file(): j = p.read_text() d = json.loads(j) print(d) ```
https://docs.python.org/3/library/pathlib.html
Reply
Anonymous
Information Epoch 1752385303
Use software leverage to your advantage.
Home
Notebook
Contact us