title: How to extract text from outside of tag with BS4
body: <p>I am trying to scan a bunch of Wikipedia pages for statistics about WWII.</p>
  
  <p>I am using BeautifulSoup to try and get all of the statistics from the column on the  right of the Wikipedia page. 
  The code is listed below.
  "links.csv" is a file with a bunch of link endings like "Battle_of_Leyte_Gulf". I have tested with the <code>&lt;h2&gt;</code> tag and it is properly accessing all sites.</p>
  
  <pre><code>import requests
  from bs4 import BeautifulSoup
  import pandas
  df=pandas.read_csv("links.csv")
  links=df['links']
  for url in links:
    # print("\n"+url+"\n")
    txt="https://en.wikipedia.org/wiki/"+url
    page=requests.get(txt)
    soup=BeautifulSoup(page.content, 'html.parser')
    tags = soup.find_all("br")
    for tag in tags:
      print(tag)
  </code></pre>
  
  <p>However, I noticed the text is not in the actual <br> tag, and it is actually outside like listed.</p>
  
  <pre><code>"Sixth Army: "
  &lt;br&gt;
  "≈200,000"
  &lt;br&gt;
  &lt;span class="flagicon"&gt;...&lt;/span&gt;
  "Air and naval forces: ≈120,000"
  </code></pre>
  
  <p>I want to know how I can get the actual text "Sixth Army: " and "≈200,000".</p>
  
  <p>link here: <a href="https://en.wikipedia.org/wiki/Battle_of_Leyte" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Battle_of_Leyte</a></p>