Re: lxml to parse html

2012-01-23 Thread Adam Tauno Williams
On Mon, 2012-01-23 at 15:39 +0800, contro opinion wrote: > import lxml.html > myxml=''' > > > Use lxml.etree not lxml.html. Your content is XML, not HTML. -- System & Network Administrator [ LPI & NCLA ] OpenGroupware Developer

Re: lxml to parse html

2012-01-23 Thread Stefan Behnel
contro opinion, 23.01.2012 08:34: > import lxml.html > myxml=''' > > > > > table="tpa_radio_sum"> > > > > > > > ''' > root=lxml.html.fromstring(myxml) > nodes1=root.xpath('//job[@DecreaseHour="1"]') > nodes2=

Re: lxml to parse html

2012-01-23 Thread Peter Otten
contro opinion wrote: > import lxml.html > myxml=''' > > > > > > > > > > > > ''' > root=lxml.html.fromstring(myxml) > nodes1=root.xpath('//job[@DecreaseHour="1"]') > nodes2=root.xpath('//job[@table="tpa_radio_sum"]') > print "nodes1=",nodes1 > print "nodes2=",nodes2 > > > nodes1=

lxml to parse html

2012-01-22 Thread contro opinion
import lxml.html myxml=''' ''' root=lxml.html.fromstring(myxml) nodes1=root.xpath('//job[@DecreaseHour="1"]') nodes2=root.xpath('//job[@table="tpa_radio_sum"]') print "nodes1=",nodes1 print "nodes2=",nodes2 >>> nodes1= [] nodes2= [, , ] would you mind to tell me why nodes1=[]?? -- h

lxml to parse html

2012-01-22 Thread contro opinion
import lxml.html myxml=''' ''' root=lxml.html.fromstring(myxml) nodes1=root.xpath('//job[@DecreaseHour="1"]') nodes2=root.xpath('//job[@ne_type="101"]') print "nodes1=",nodes1 print "nodes2=",nodes2