I am very new and trying to learn how to scratch tables. I have the following code, but I can not get two variables to print on the same line; they are printed on separate lines. What am I missing?
from lxml import html
from bs4 import BeautifulSoup
import requests
url = "http://www.columbia.edu/~fdc/sample.html"
r = requests.get(url)
soup = BeautifulSoup(r.content)
tables = soup.findAll('table')
for table in tables:
Second_row_first_column = table.findAll('tr')[1].findAll('td')[0].text
Second_row_second_column = table.findAll('tr')[1].findAll('td')[1].text
print Second_row_first_column + Second_row_second_column
source
share