从 html table 创建 json 文件

Make json file from html table

这里有一个 Html table 在这个网站 http://people.dbmi.columbia.edu/~friedma/Projects/DiseaseSymptomKB/

有一个名为 "Disease Name" 的列和一个名为 "Symptoms" 的以下列。我想以这种方式从该网站的 table 中获取 JSON 格式的数据,并从字符串中删除 "UMLS:C00080" 内容。

data = {
   {
    disease_name:'name',
    symptoms: [symptoms ]
   }
}

有什么方法可以用 python 做到吗?

有 BS4

import requests
from bs4 import BeautifulSoup

r = requests.get(
    "http://people.dbmi.columbia.edu/~friedma/Projects/DiseaseSymptomKB/index.html")


soup = BeautifulSoup(r.text, 'html.parser')

for item in soup.findAll("p", {'class': 'MsoNormal'}):
    item = item.get_text(strip=True)
    if item.startswith("UMLS"):
        print(item)