-
if 문 괄호 생활화에러 삽질 2022. 4. 20. 12:57
import os import glob data_root = "C:\\Users\\user\\Downloads\\Image_train_remove_aug_again" data_aug = os.listdir(data_root) for i in range(len(data_aug)): try: name_list = data_aug[i].split('_') height = name_list[-2] weight = name_list[-1][:-8] BMI_ = (int(weight) / 100000) / ((int(height) / 100000) ** 2) if BMI_ > 25 and BMI_ < 35 : if ("orgin" in name_list) or ("fliped" in name_list): if os.path.exists(data_root): os.remove(os.path.join(data_root, data_aug[i])) except: data_aug[i]=data_aug[i].replace(']','_') name_list = data_aug[i].split('_') height = name_list[-3] weight = name_list[-2] BMI_ = (int(weight) / 100000) / ((int(height) / 100000) ** 2) if BMI_ > 25 and BMI_ < 35 : if ("orgin" in name_list) or ("fliped" in name_list): if os.path.exists(data_root): os.remove(os.path.join(data_root, data_aug[i])) #data_aug
orgin or fliped에 괄호를 치지 않아 모두 지워지는 사태가 발생하였다.
괄호를 생활화 하자
그리고 더블체크
생활화 하자.
'에러 삽질' 카테고리의 다른 글
데이터셋 간에 차이 (mesh 편) (1) 2022.06.06 ps -af 우분투 실행창 관리 (0) 2022.06.06 model load missing keys and unexpected keys (0) 2022.04.02 어느 카테고리에도 속하지 못한 depth rendering (0) 2022.03.15 opecv (0) 2022.03.06