In addition to child and parent nodes , And peer nodes , Also known as sibling nodes . Can pass next_sibling Property to get the next sibling node of the current node , adopt previous_sibling Property to get the previous sibling node of the current node . adopt next_siblings Property to get all the sibling nodes behind the current node ( Returns an iteratable object ), adopt previous_siblings Property to get all the sibling nodes in front of the current node ( Returns an iteratable object ).
Pay attention here , If there is a newline or other text between two nodes , Then these attributes will also return these text nodes , Text between nodes will be processed as a text node . The text node is bs4.element.NavigableString Class , Ordinary nodes are bs4.element.Tag Class .
Now with the following HTML Code, for example , Explain the difference between text nodes and ordinary nodes .
<ul>
<li class="item1"><a href="https://www.jd.com"> Jingdong Mall </a></li>
hello world
<li class="item2"><a href="htt