I have a script where I'm walking through a list of passed (via a csv file) paths. I'm wondering how I can determine if the path I'm currently working with has been previously managed (as a subdirectory of the parent).
I'm keeping a list of managed paths like this:
pathsManaged = ['/a/b', '/c/d', '/e']
So when/if the next path is '/e/a', I want to check in the list if a parent of this path is present in the pathsManaged list.
My attempt so far:
if any(currPath in x for x in pathsManaged):
print 'subdir of already managed path'
This doesn't seem to be working though. Am I expecting too much from the any command. Are there any other shortcuts that I could use for this type of look-up?
Thanks