중급1 [중급] 파이썬 객체지향프로그래밍 tip 3가지 1. init 메서드init은 Python 클래스에서 생성자(constructor) 역할객체(Object)가 생성될 때 자동으로 호출되며, 초기 설정을 담당객체 생성과 동시에 데이터를 설정할 수 있어 편리객체 생성과 동시에 데이터를 설정하여 편리class DataCollector: def __init__(self, path="./data"): self.path = path # 데이터 저장 경로 설정 self.transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize((0.5,), (0.5,)) ]) self.train_data = .. 2025. 2. 15. 이전 1 다음