[Python-ideas] os.path.isparent and os.path.ischild

John O'Connor jxo6948 at rit.edu
Fri Jul 8 01:24:07 CEST 2011


On Thu, Jul 7, 2011 at 4:08 PM, Giampaolo Rodolà <g.rodola at gmail.com> wrote:

> >>> isparent('/a', '/a/b')
> True
> >>> isparent('/a/b', '/a')
> False
>

>>> ischild('/a/b', '/a')
> True
> >>> ischild('/a', '/a/b')
> False
>

What about is{ancestor, descendant}() ?

>>> isancestor('/a', '/a/b/c')
True
>>> isparent('/a', '/a/b/c')
False
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110707/2f9db3bf/attachment.html>


More information about the Python-ideas mailing list