title: How does join work in python beautifulsoup
body: <p>I am learning python and beautifulsoup, and saw this code online:</p>
  
  <pre><code>from BeautifulSoup import BeautifulSoup, SoupStrainer
  import re
  
  html = ['&lt;html&gt;&lt;body&gt;&lt;p align="center"&gt;&lt;b&gt;&lt;font size="2"&gt;Table 1&lt;/font&gt;&lt;/b&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;1. row 1, cell 1&lt;/td&gt;&lt;td&gt;1. row 1, cell 2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;1. row 2, cell 1&lt;/td&gt;&lt;td&gt;1. row 2, cell 2&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;p align="center"&gt;&lt;b&gt;&lt;font size="2"&gt;Table 2&lt;/font&gt;&lt;/b&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;2. row 1, cell 1&lt;/td&gt;&lt;td&gt;2. row 1, cell 2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;2. row 2, cell 1&lt;/td&gt;&lt;td&gt;2. row 2, cell 2&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/html&gt;']
  soup = BeautifulSoup(''.join(html))
  searchtext = re.compile(r'Table\s+1',re.IGNORECASE)
  foundtext = soup.find('p',text=searchtext) # Find the first &lt;p&gt; tag with the search text
  table = foundtext.findNext('table') # Find the first &lt;table&gt; tag that follows it
  rows = table.findAll('tr')
  for tr in rows:
      cols = tr.findAll('td')
      for td in cols:
          try:
              text = ''.join(td.find(text=True))
          except Exception:
              text = ""
          print text+"|",
      print
  </code></pre>
  
  <p>while everything else is clear, i could not understand how the join is working.</p>
  
  <pre><code>    text = ''.join(td.find(text=True))
  </code></pre>
  
  <p>I tried searching the BS documentation for join, but i couldn't find anything and couldn't really find help online as well on how join is used in BS.</p>
  
  <p>Please let me know how that line works. thanks!</p>
  
  <p>PS: the above code is from another stackoverflow page, its not my homework :)
  <a href="https://stackoverflow.com/questions/5711483/how-can-i-find-a-table-after-a-text-string-using-beautifulsoup-in-python">How can I find a table after a text string using BeautifulSoup in Python?</a></p>