From d776ff6bd3c7260b2773a36a0415af58ab4fb26e Mon Sep 17 00:00:00 2001 From: XXXXRT666 Date: Fri, 12 Jul 2024 23:58:58 +0800 Subject: [PATCH] clean path --- tools/my_utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/my_utils.py b/tools/my_utils.py index de79f3b5..60acb274 100644 --- a/tools/my_utils.py +++ b/tools/my_utils.py @@ -25,7 +25,9 @@ def load_audio(file, sr): return np.frombuffer(out, np.float32).flatten() -def clean_path(path_str): +def clean_path(path_str:str): + if path_str.endswith(('\\','/')): + return clean_path(path_str[0:-1]) if platform.system() == 'Windows': path_str = path_str.replace('/', '\\') - return path_str.strip(" ").strip('"').strip("\n").strip('"').strip(" ").strip("\u202a") + return path_str.strip(" ").strip('"').strip("\n").strip('"').strip(" ").strip("\u202a") \ No newline at end of file