A
A
AlessandrIT2020-06-05 15:38:20
Python
AlessandrIT, 2020-06-05 15:38:20

How to get tr tag arguments when parsing with lxml Python?

My code parses the page, finds the required table on it, and gets a list of tr tags.

Such

for element in list_:
  print(element)
the code returns a list of

<Element tr at 0x341ad20>
<Element tr at 0x3cd7450>
<Element tr at 0x3cd74b0>
<Element tr at 0x3cd74e0>


These elements contain the id field , which is what the program needs to get. How to do it? <tr id="xxx">...</tr>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AlessandrIT, 2020-06-05
@AlessandrIT

Issue resolved.

print(element.values())

['list', '31526869']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question