import requests from bs4 import BeautifulSoup url = "http://www.pref.hokkaido.lg.jp/hf/kth/kak/hasseijoukyou.htm" headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko", } r = requests.get(url, headers=headers) r.raise_for_status() soup = BeautifulSoup(r.content, "html5lib") data = [ [td.get_text(strip=True) for td in trs.find_all(["th", "td"])] for trs in soup.find("table").find_all("tr") ]