constructin trees in python

2010-11-20 Thread Maxim Mercury
Hi , Iam very much new to python. Iam trying to construct a xml dom tree using the builtin HTMLParser class (on data event callbacks). Iam maintaining the childs as a list of elements and whenver the sax parser encounters a tag i push it to a local stack, my basic logic is below. ** de

Re: constructin trees in python

2010-11-20 Thread Maxim Mercury
On Nov 20, 2:03 pm, Peter Otten <__pete...@web.de> wrote: > Maxim Mercury wrote: > > here is the definintion of htmlelement > > > class HTMLElement: > >     tag=None > >     attrs={} > >     data='' > >     childs=[] > > &

strings getting unnecessarily cut in lstrip

2010-11-21 Thread Maxim Mercury
I was using the lstrip to trim the left occurance of a string, and it didnt seem to work for some cases. but when i investigated there does seem to be an issue with some combination of strings here is one case p1 = "abcd" p2 = 'def'# $abc sym = '_' str1 = p1 + sym + p2 str1