从this页中,我想提取“注释”中的所有文本,即:
'通过GABAB抑制大鼠DRG神经元中的N型Ca2+通道电流,IC50为1.7nM(Callaghan等人,2008年),a9 KO小鼠的DRG中为24.6nM(Callaghan等人,2010年)。具体受体仍不清楚'
我写道:
import requests
import pandas as pd
from bs4 import BeautifulSoup
import re
import time
for each_page in range(4,5):
try:
page_name = 'P' + "{:05d}".format(each_page)
res = requests.get("http://www.conoserver.org/index.php?page=card&table=protein&id=" + str(each_page))
soup = BeautifulSoup(res.content, 'lxml')
final_df = pd.DataFrame()
precursor_table = soup.find_all('table',{'class':'cardtable'})
precursor_table_df = pd.read_html(str(precursor_table))[0].transpose()
header = precursor_table_df.iloc[0]
precursor_table_df = precursor_table_df[1:]
precursor_table_df= precursor_table_df.rename(columns = header)
print(precursor_table_df)
except:
pass
但“Notes”的输出逐渐减少:
“通过……抑制N型钙通道电流”
代替:“通过GABAB抑制大鼠DRG神经元中的N型Ca2+通道电流,IC50为1.7nM(Callaghan等人,2008年)和a9 KO小鼠的小鼠DRG中的24.6nM(Callaghan等人,2010年)。具体的受体还不清楚
有人能告诉我一个更好的方法,让完整的笔记字段作为文本块返回吗
目前没有回答
相关问题 更多 >
编程相关推荐