HTML:
"<td class='tdtl'><a class='col' href='detail.php?id=1' target='_blank''>List 1< br>detail 1</a></td>"
"<td class='tdtl'><a class='col' href='detail.php?id=2' target='_blank''>List 2< br>detail 2</a></td>"
"<td class='tdtl'><a class='col' href='detail.php?id=3' target='_blank''>List 3< br>detail 3</a></td>"
"<td class='tdtl'><a class='col' href='detail.php?id=4' target='_blank''>List 4< br>detail 4</a></td>"
"<td class='tdtl'><a class='col' href='detail.php?id=5' target='_blank''>List 5< br>detail 5</a></td>"
Python coding:
for index in soup.select("col"):
print(index.get_text())
RESULT:
Line 1detail 1
Line 2detail 2
Line 3detail 3
Line 4detail 4
Line 5detail 5
How to retrieve "Line 1" and "detail 1" in variables?
` looks like `< br>` in the `HTML`? – baduker Feb 12 '21 at 09:51
" tag on my question. Therefore, adding a spare is only for display. – TEQ Feb 12 '21 at 10:14