Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16142 > unrolled thread
| Started by | nirman longjam <nirmanlongjam@gmail.com> |
|---|---|
| First post | 2011-11-23 19:50 -0800 |
| Last post | 2011-11-24 09:24 -0800 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
Tree data structure with: single, double and triple children option along with AVM data at each node nirman longjam <nirmanlongjam@gmail.com> - 2011-11-23 19:50 -0800
Re: Tree data structure with: single, double and triple children option along with AVM data at each node Miki Tebeka <miki.tebeka@gmail.com> - 2011-11-24 09:24 -0800
| From | nirman longjam <nirmanlongjam@gmail.com> |
|---|---|
| Date | 2011-11-23 19:50 -0800 |
| Subject | Tree data structure with: single, double and triple children option along with AVM data at each node |
| Message-ID | <7548c4b6-f3f1-4f96-9a77-fcb9e0edeed0@s4g2000yqk.googlegroups.com> |
Dear sir, I am very happy to find this group. Sir, i am new to Python. Currently i am working on text processing. Can you give me some suggestions about Tree data structure representation, where i require each node capable to handle: only one child, or up to 3 children plus hold feature information. Thanking you, L. Nirman Singh
[toc] | [next] | [standalone]
| From | Miki Tebeka <miki.tebeka@gmail.com> |
|---|---|
| Date | 2011-11-24 09:24 -0800 |
| Message-ID | <29675595.296.1322155464662.JavaMail.geo-discussion-forums@vbjs5> |
| In reply to | #16142 |
There a many ways to do this, here's one:
from collections import namedtuple
Tree = namedtuple('Tree', ['feature', 'children'])
t = Tree(1, [Tree('hello', []), Tree(3, [])])
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web