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): print 'B save' 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 in os.walk(root, topdown=topdown): if relative: […]