Srinivas Iyyer wrote:
> Dear group,
> I have a problem in finding a method to solve a
> problem where I want to walk through a lineage of
> terms and find group them from right to left.
>
> A snippet of the problem is here. The terms in file as
> tab delim manner.
>
> a b c d
> A snippet of the problem is here. The terms in file as
> tab delim manner.
[data cut]
> Now my question is to enrich members that have identical lineage with
> different leaf. 'i.e': a b c d - van suv.
Hi Srinivas,
You're starting to use the vocabulary of tree data structures here. Let's
What about choosing a native Python data structure for this?
A list of attributes comes to mind, as presence of one can be easily
tested with
if x in attributes:
do_something
Here's a test:
>>> elements= {}
>>> elements['boat'] = ['a', 'b', 'j', 'k']
>>> 'a' in elements['boat']
True
>