title: Beautiful Soup Scraping table
body: <p>I have this small piece of code to scrape table data from a web site and then display in a csv format. The issue is that for loop is printing the records multiple time . I am not sure if it is due to <br> tag. btw I am new to Python. Thanks for your help!</p>
  
  <pre><code>#import needed libraries
  import urllib
  from bs4 import BeautifulSoup
  import requests
  import pandas as pd
  import csv
  import sys
  import re
  
  
  # read the data from a URL
  url = requests.get("https://www.top500.org/list/2018/06/")
  
  # parse the URL using Beauriful Soup
  soup = BeautifulSoup(url.content, 'html.parser')
  
  newtxt= ""
  for record in soup.find_all('tr'):
      tbltxt = ""
      for data in record.find_all('td'):
          tbltxt = tbltxt + "," + data.text
          newtxt= newtxt+ "\n" + tbltxt[1:]
          print(newtxt)
  </code></pre>