title: Parse HTML table data to JSON and save to text file in Python 2.7
body: <p>I'm trying to extract the data on the crime rate across states from
      this webpage, link to web page
      <a href="http://www.disastercenter.com/crime/uscrime.htm" rel="nofollow">http://www.disastercenter.com/crime/uscrime.htm</a></p>
  
  <p>I am able to get this into text file. But I would like to get the
      response in Json format. How can I do this in python.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import urllib        
  import re     
  
  from bs4 import BeautifulSoup    
  link = "http://www.disastercenter.com/crime/uscrime.htm"    
  f = urllib.urlopen(link)    
  myfile = f.read()    
  soup = BeautifulSoup(myfile)    
  soup1=soup.find('table', width="100%")    
  soup3=str(soup1)    
  result = re.sub("&lt;.*?&gt;", "", soup3)    
  print(result)    
  output=open("output.txt","w")    
  output.write(result)    
  output.close()    
  </code></pre>