I tried this,
import requests
from bs4 import BeautifulSoup
import pandas
from pprint import pprint
url='http://guba.sina.com.cn/?s=bar&name=sh000001'
r = requests.get(url)
soup = BeautifulSoup(r.content,'html.parser')
table = soup.find("table", {"id" : "curr_table"})
tableRows = [[td.text for td in row.find_all("td")] for row in table.find_all("tr")[1:]]
#get headers for dataframe
tableHeaders = [th.text for th in table.find_all("th")]
#build df from tableRows and headers
df = pandas.DataFrame(tableRows, columns=tableHeaders)
print(df)
but it has a mistake
tableRows = [[td.text for td in row.find_all("td")] for row in table.find_all("tr")[1:]]
AttributeError: 'NoneType' object has no attribute 'find_all'
and this
from urllib import request
url = " http://guba.sina.com.cn/?s=bar&name=sh000001"
html = request.urlopen(url).read().decode('ISO-8859-1')
html[:60]
from bs4 import BeautifulSoup
soup = BeautifulSoup(html, 'html.parser')
title = soup.find('title')
print(title) # Prints the tag
print(title.string) # Prints the tag string content
but it outputs words in the wrong format