delojza/util.py
2021-09-14 16:06:10 +02:00

18 lines
374 B
Python

from _typeshed import StrPath
from datetime import datetime
import os
import errno
def mkdir_p(path: StrPath) -> None:
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
def datestr(date: datetime) -> str:
return date.strftime("%Y-%m-%d@%H%M")