Dear Python developers

I have the following (sorted) list.
['/notebook',
 '/notebook/mac',
 '/notebook/mac/macbook',
 '/notebook/mac/macbookpro',
 '/notebook/pc',
 '/notebook/pc/lenovo',
 '/notebook/pc/hp',
 '/notebook/pc/sony',
 '/desktop',
 '/desktop/pc/dell',
 '/desktop/mac/imac',
 '/server/hp/proliant',
 '/server/hp/proliant/385',
 '/server/hp/proliant/585'
]

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
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to