From f60dc7f99404d7896251c011adc8e413dfe8cf4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AD=94=E9=AC=BC=E9=9D=A2=E5=85=B7?= <45996119+z1069614715@users.noreply.github.com> Date: Thu, 8 Dec 2022 16:49:24 +0800 Subject: [PATCH] Update processing.py --- processing.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/processing.py b/processing.py index 90e0641..dd454ce 100644 --- a/processing.py +++ b/processing.py @@ -33,13 +33,13 @@ def parse_opt(): if __name__ == '__main__': opt = parse_opt() - # with open(opt.label_path, 'w+', encoding='utf-8') as f: - # f.write('\n'.join(os.listdir(opt.data_path))) + with open(opt.label_path, 'w+', encoding='utf-8') as f: + f.write('\n'.join(os.listdir(opt.data_path))) str_len = len(str(len(os.listdir(opt.data_path)))) - # for idx, i in enumerate(os.listdir(opt.data_path)): - # os.rename(r'{}/{}'.format(opt.data_path, i), r'{}/{}'.format(opt.data_path, str(idx).zfill(str_len))) + for idx, i in enumerate(os.listdir(opt.data_path)): + os.rename(r'{}/{}'.format(opt.data_path, i), r'{}/{}'.format(opt.data_path, str(idx).zfill(str_len))) os.chdir(opt.data_path)