Q:

Python scraping with BeautifulSoup, Only scrape paragraphs with certain word in it

So I was able to scrape the whole chapter of statutes from code below. However, lets say if I only want to scrape the paragraph with word "agricultural" in it. How do I do that?
from bs4 import BeautifulSoup
import requests
import re

f = open('C:\Python27\projects\Florida\FL_finalexact.doc','w')

base_url = "http://www.flsenate.gov/Laws/Statutes/2015/Chapter{chapter:03d}/All"

for chapter in range (1,40):  
  url = base_url.format(chapter=chapter)
  try:
    r = requests.get(url)
  except requests.exceptions.RequestException as e:   
      print "missing url"
      print e
      sys.exit(1)
  soup = BeautifulSoup((r.content),"html.parser")
  tableContents = soup.find('div', {'class': 'Chapters' })

  if tableContents is not None:
     for title in tableContents.find_all ('div', {'class': 'Title' }):
      f.write ('\n\n' + title.text + '\n\n' )

     for data in tableContents.find_all ('div',{'class':'Section' }):
      data = data.text.encode("utf-8","ignore")
      data = "\n" + str(data)+ "\n" 
      f.write(data)

Do I need to use regular expression for this task?

A:

You don't need a regular expression. BeautifulSoup is more powerful than that:
soup = BeautifulSoup(r.content)
soup.find_all(lambda tag: "agricultural" in tag.string if tag.string else False)

is sufficient to give you a list of all elements which contain the word "agricultural" in it. You can then iterate through the list and pull out the relevant strings:
results = soup.find_all(...) # function as before
scraped_paragraphs = map(lambda element: element.string, results)

and then write the elements in scraped_paragraphs wherever you will. 
How This Works
BeautifulSoup supports a find_all() feature that will return all tags that match a particular criterion fed in to find_all(). This criterion can take on the form of a regular expression, a function, a list or even just True. In this case, a suitable boolean function is enough.
More importantly, however, every HTML tag in soup is indexed by a variety of attributes. You can query an HTML tag for attributes, children, siblings, and, of course, a contained inner text marked by string. 
What this solution does is simply filter through the parsed HTML for all those elements whose string contains "agricultural" in it. Because not every element has a string attribute, it is necessary to make sure we first check that it has one - hence why we do if tag.string and return False if not found. 
An Example
Here's what it looks like for Chapter001:
soup.find_all(lambda tag: "agricultural" in tag.string if tag.string else False)
>>>> [<span class="Text Intro Justify" xml:space="preserve">Crude turpentine gum (oleoresin), the product of a living tree or trees of the
     pine species, and gum-spirits-of-turpentine and gum resin as processed therefrom, shall be taken and understood to be agricultural 
     products, farm products, and agricultural commodities.</span>, 
     <span class="Text Intro Justify" xml:space="preserve">Whenever the terms “agriculture,” “agricultural purposes,” “agricultural uses,” or 
     words of similar import are used in any of the statutes of the state, such terms include aquaculture, horticulture, and floriculture; 
     aquacultural purposes, horticultural purposes, and floricultural purposes; aquacultural uses, horticultural uses, and floricultural uses; 
     and words of similar import applicable to agriculture are likewise applicable to aquaculture, horticulture, and floriculture.
     </span>]

Calling the map function on results yields the inner strings without accompanying span elements and nasty attributes:
map(lambda element : element.string, soup.find_all(...)
>>>> [u'Crude turpentine gum (oleoresin), the product of a living tree or trees of the pine species, and gum-spirits-of-turpentine and gum resin as processed therefrom, shall be taken and understood to be agricultural products, farm products, and agricultural commodities.', 
      u'Whenever the terms \u201cagriculture,\u201d \u201cagricultural purposes,\u201d \u201cagricultural uses,\u201d or words of similar import are used in any of the statutes of the state, such terms include aquaculture, horticulture, and floriculture; aquacultural purposes, horticultural purposes, and floricultural purposes; aquacultural uses, horticultural uses, and floricultural uses; and words of similar import applicable to agriculture are likewise applicable to aquaculture, horticulture, and floriculture.']

