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)