Home > other >  Rookie help a collection problem
Rookie help a collection problem

Time:10-26

I'd like to collect the following content in the yellow grid. But the web on the line 2 is equivalent to 1 line.
Content is: & lt; td> 13 & lt;/td>
I use the xpath://table [@ class='pub_table']/tbody tr [2]/[1] [4] to collect/td out is 913,
Tried N times, we can not collect the separate 13. I just want to gather 13, this should be how to modify?


This is the website: http://odds.500.com/fenxi/bifen-869554.shtml
Is the top left corner of the table 9 and 13



CodePudding user response:

Content you got, then use a regular extracted not good?

CodePudding user response:

reference 1/f, 7-eleven's response:
content you got, and then use a regular extracted not good?

Thank you reply, I am not regular.

CodePudding user response:

 import re 

The content='& lt; td> 13 & lt;/td> '
NumberArray=re. The.findall (r '& lt;/span> (\ d +) & lt; ', STR (content))
Print (NumberArray [0])

CodePudding user response:

The
reference 3 floor 7-eleven's response:
 import re 

The content='& lt; td> 13 & lt;/td> '
NumberArray=re. The.findall (r '& lt;/span> (\ d +) & lt; ', STR (content))
Print (NumberArray [0])


Thanks to the teacher, was laborious!
  • Related