Posted By

cieux-gris on 09/03/08


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

carlosabargues


contains dir


 / Published in: Python
 

Given a directory path, return true if that directory contains at least one other directory. Otherwise, return false.

  1. def containsDir (dirPath):
  2. contents=os.listdir(dirPath)
  3. dirList=[item for item in contents if os.path.isdir(os.path.join(dirPath,item))]
  4. return not dirList==list()

Report this snippet  

You need to login to post a comment.