简体   繁体   中英

How can I traverse all the children of all tags to get the data using lxml in python?

I want to traverse all the child nodes in html page. eg <body>......</body> will have many child tags I want to traverse all those tags recursively so that none of the tag remains unvisited. Then I want to get the text from each tag. I am looking for a general solution which will work for any webpage with any kind of structure it may has. Can anybody suggest this? Thank you

是的, python beautiful soap是一个很棒的python库,具有许多功能。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM