Python의 Super() 함수의 역할을 이해할수 있는 예제

class A(object): def save(self): print 'A saved' class B(A): def save(self): print 'B saved' A.save(self) class C(A): def save(self): print 'C saved' A.save(self) class D(B, C): def save(self): print 'D saved' B.save(self) C.save(self) a = D() a.save() print "—————————————-" class A(object): def save(self): print 'A saved' class B(A): def _save(self): 더 읽기

Python Source 디렉토리 구조 검색

def ls(dir, hidden=False, relative=True): nodes = [] for nm in os.listdir(dir): if not hidden and nm.startswith('.'): continue if not relative: nm = os.path.join(dir, nm) nodes.append(nm) nodes.sort() return nodes def find(root, files=True, dirs=False, hidden=False, relative=True, topdown=True, self_check=False): root = os.path.join(root, '') # add slash if not there for parent, ldirs, lfiles 더 읽기