python - Taking only 1 on 3 <tr> -


i'm parsing website extract data in python using xpaths.

but don't know how thing :

<tr> </tr> <tr> </tr> <tr> data </tr> <tr> </tr> <tr> </tr> <tr> data </tr> <tr> </tr> <tr> </tr> <tr> data </tr> 

i know can //tr[3] thrid one. how can thirds ?

use position funxtion , take remainder of division 3. because xpath understand 0 false, can write

//tr[not(position() mod 3)] 

Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -