title: Extracting a table from Webpage in Python
body: <p>I have tried reading a table from a website. It can be seen from my code that I have gone too far to get the table, I would appreciate if someone give me an opportunity to learn a quick method to do the same.</p>
  
  <h2>Here's my code:</h2>
  
  <pre><code>    import urllib.request
      from bs4 import BeautifulSoup
      url = "http://www.kazusa.or.jp/codon/cgi-bin/showcodon.cgi?species=9606&amp;aa=1&amp;style=N"
      html = urllib.request.urlopen(url).read()
      soup = BeautifulSoup(html)
      text = soup.get_text()
      with open('myfile.txt', 'w') as file:
          file.writelines(text)
      with open('myfile.txt','r') as g:
          f = g.readlines()
      tab = f[12:31]
      table = [x.strip() for x in tab]
  </code></pre>
  
  <hr>
  
  <p>Every time running the code messes up with writing and reading the file.</p>