python - How to find lists after a specific word -
I am trying to find all the lists after those words, which I want to do in categories according to that word .
So my sample data is as follows:
& lt; P & gt; & Lt; A href = "#" & gt; Word A & lt; / A & gt; & Lt; / P & gt; & Lt; Ul & gt; & Lt; Li & gt; Some & lt; / Li & gt; & Lt; Li & gt; Some & lt; / Li & gt; & Lt; Ul & gt; & Lt; P & gt; & Lt; A href = "#" & gt; Word & lt; / A & gt; & Lt; / P & gt; & Lt; Ul & gt; & Lt; Li & gt; Some & lt; / Li & gt; & Lt; Li & gt; Some & lt; / Li & gt; & Lt; Ul & gt;
Keeping the above example in mind, I want Tiwari Fetch Word A
and the categories that are in the list below, and for this WordB
.
Is it possible to search for WordA
and below & lt; Ul & gt;
Find tags
Changing all the links in the paragraph, parent for each link Get the ul
tag to the next person and get all Li
inside the tag (helps to get the next ul
element after the article)
/ A & gt; & lt; / p & gt; & lt; ul & gt; & lt; li & gt; Some & lt; / li & gt; & lt; li & gt; Some & lt; / li & Gt;
Print:
WordA Something ----- WordB Something like -----
Comments
Post a Comment