Compare commits

...

1 Commits

Author SHA1 Message Date
ecf4a2ed7a Add exercises from sw5 theory lesson 2026-03-20 15:18:03 +01:00
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,17 @@
import logging
from pathlib import Path
Path("data/logs").mkdir(parents=True, exist_ok=True)
Path("data/logs/app.log").open("a")
logging.basicConfig(
level=logging.ERROR,
filename="data/logs/app.log",
filemode="a",
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
)
logging.debug("Application started")
logging.info("Application started")
logging.warning("Application started")
logging.error("Application started")
logging.critical("Application started")

View File

@ -0,0 +1,22 @@
import json
from pathlib import Path
def create_orders():
path = Path("data/processed")
path.mkdir(parents=True, exist_ok=True)
orders_path = path / "orders.csv"
orders_path.open("w", encoding="utf-8")
def create_settings():
settings = {"mode": "debug", "retries": 3}
with Path("data/processed/settings.json").open("w", encoding="utf-8") as f:
json.dump(settings, f, indent=2, ensure_ascii=False)
if __name__ == "__main__":
# create_orders()
(create_settings())