From 4aaaa3c349f2a0ac6c1b8b39fd742c8df68a265c Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Wed, 24 Nov 2021 19:28:25 -0500 Subject: [PATCH] [O] Use file.parent instead of splitting / --- src/utils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/utils.py b/src/utils.py index ee200e0..b4e316b 100644 --- a/src/utils.py +++ b/src/utils.py @@ -82,8 +82,7 @@ def write(file: str, text: str) -> None: file = file.lower().replace('\\', '/') if '/' in file: - path = '/'.join(file.split('/')[:-1]) - Path(path).mkdir(parents=True, exist_ok=True) + Path(file).parent.mkdir(parents=True, exist_ok=True) with open(file, 'w', encoding='utf-8') as f: f.write(text)