Nico Grubert wrote:
Dear Python developers... I have the following (sorted) list....

I want to remove all paths x from the list if there is a path y in the list which is part of x so y.startswith(x) is true.

The list I want to have is:
['/notebook', '/desktop', '/server/hp/proliant']

Any idea how I can do this in Python?

Thanks in advance
Nico
Here's a tricky case that doesn't show up in your example:
In each case above, the directory names are distinct.
how about:
['/desk', '/desk/ethanallen', '/desk/ikea',
 '/desktop', /desktop/pc', '/desktop/mac']
Should the answer be ['/desk'] or ['/desk', '/desktop'] ?

--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to