From c3768a6306d9cc763cfcb86161ab0ad719cf6f22 Mon Sep 17 00:00:00 2001 From: Mathhew Date: Wed, 16 Sep 2020 21:46:21 +0800 Subject: [PATCH] Clear blank --- core.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core.py b/core.py index 49bf590..5938b75 100755 --- a/core.py +++ b/core.py @@ -203,6 +203,7 @@ def create_folder(success_folder, location_rule, json_data, conf: config.Config) path = success_folder + '/' + location_rule.replace("'actor'", "'manypeople'", 3).replace("actor","'manypeople'",3) # path为影片+元数据所在目录 else: path = success_folder + '/' + location_rule + path = trimblank(path) if not os.path.exists(path): path = escape_path(path, conf.escape_literals()) try: @@ -215,6 +216,15 @@ def create_folder(success_folder, location_rule, json_data, conf: config.Config) return path +def trimblank(s: str): + """ + Clear the blank on the right side of the folder name + """ + if s[-1] == " ": + return trimblank(s[:-1]) + else: + return s + # =====================资源下载部分=========================== # path = examle:photo , video.in the Project Folder!