为了账号安全,请及时绑定邮箱和手机立即绑定

如何使用 Python 找到 BeautifulSoup 的下一个标签/元素?

如何使用 Python 找到 BeautifulSoup 的下一个标签/元素?

繁华开满天机 2023-10-18 16:07:10
如何找到下一个标签/元素?首先,我搜索我想要的 HTML 页面部分soup_title = soup.find('a', id=title_idnext).getText()这回来了"7 DRUG INTERACTIONS "从<a class="" href="#" id="anch_dj_dj-dj_9">7 DRUG INTERACTIONS </a>到目前为止一切都很好。接下来,我使用soup.find_next_element('div', class_='Section toggle-content closed long-content')从中查找一些文本段落<div class="Section toggle-content closed long-content" data-sectioncode="34073-7" style=""><p>paragraph1...</p><p>paragraph2...</p><p>paragraph3...</p></div>但我得到的只是空的,空字符串我尝试过 soup.find_next_sibling/s、soup.findNextSibling/s - 没有乐趣实际的URL是https://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=00a574e0-bd03-deea-9f85-b108f78982ba
查看完整描述

2 回答

?
慕田峪4524236

TA贡献1875条经验 获得超5个赞

既然您已经确定了需要用来find_next()获取 div 标签的锚标记。


res=requests.get("https://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=00a574e0-bd03-deea-9f85-b108f78982ba").text

soup=BeautifulSoup(res,'html.parser')

soup_title = soup.find('a', id='anch_dj_dj-dj_9')

print(soup_title.getText())

print(soup_title.find_next('div', class_='Section toggle-content closed long-content').text) 

输出:


7 DRUG INTERACTIONS 




Tables 2 and 3 include drugs with clinically important drug interactions and interaction with diagnostics when administered concomitantly with lansoprazole delayed release capsules and instructions for preventing or managing them.

Consult the labeling of concomitantly used drugs to obtain further information about interactions with PPIs. 


Table 2. Clinically Relevant Interactions Affecting Drugs Co-Administered with Lansoprazole Delayed Release Capsules and Interactions with Diagnostics





Antiretrovirals



 Clinical Impact: The effect of PPIs on antiretroviral drugs is variable. The clinical importance and the mechanisms behind these interactions are not always known. 

 Decreased exposure of some antiretroviral drugs (e.g., rilpivirine, atazanavir, and nelfinavir) when used concomitantly with lansoprazole may reduce antiviral effect and promote the development of drug resistance.

Increased exposure of other antiretroviral drugs (e.g., saquinavir) when used concomitantly with lansoprazole may increase toxicity of the antiretroviral drugs.

There are other antiretroviral drugs which do not result in clinically relevant interactions with lansoprazole.





Intervention:  Rilpivirine-containing products: Concomitant use with Lansoprazole delayed release capsules is contraindicated [see Contraindications (4)]. See prescribing information. 

 Atazanavir: See prescribing information for atazanavir for dosing information. 

 Nelfinavir: Avoid concomitant use with Lansoprazole. See prescribing information for nelfinavir. 

 Saquinavir: See the prescribing information for saquinavir and monitor for potential saquinavir toxicities. 

 Other antiretrovirals: See prescribing information. 



Warfarin



 Clinical Impact: Increased INR and prothrombin time in patients receiving PPIs and warfarin concomitantly. Increases in INR and prothrombin time may lead to abnormal bleeding and even death. 



Intervention:  Monitor INR and prothrombin time. Dose adjustment of warfarin may be needed to maintain target INR range. See prescribing information for warfarin. 



Methotrexate



Clinical Impact:  Concomitant use of PPIs with methotrexate (primarily at high dose) may elevate and prolong serum concentrations of methotrexate and/or its metabolite hydroxymethotrexate, possibly leading to methotrexate toxicities. No formal drug interaction studies of high-dose methotrexate with PPIs have been conducted [see Warnings and Precautions (5.8)]. 



Intervention:  A temporary withdrawal of Lansoprazole may be considered in some patients receiving high-dose methotrexate. 



Digoxin



 Clinical Impact: Potential for increased exposure of digoxin 



Intervention:  Monitor digoxin concentrations. Dose adjustment of digoxin may be needed to maintain therapeutic drug concentrations. See prescribing information for digoxin. 



Theophylline



 Clinical Impact : Increased clearance of theophylline [see Clinical Pharmacology (12.3)]. 



Intervention Individual patients may require additional titration of their theophylline dosage when Lansoprazole is started or stopped to ensure clinically effective blood concentrations. 



Drugs Dependent on Gastric pH for Absorption (e.g., iron salts, erlotinib, dasatinib, nilotinib, mycophenolate mofetil, ketoconazole/itraconazole)



Clinical Impact:  Lansoprazole can reduce the absorption of other drugs due to its effect on reducing intragastric acidity. 



Intervention:  Mycophenolate mofetil (MMF): Co-administration of PPIs in healthy subjects and in transplant patients receiving MMF has been reported to reduce the exposure to the active metabolite, mycophenolic acid (MPA), possibly due to a decrease in MMF solubility at an increased gastric pH. The clinical relevance of reduced MPA exposure on organ rejection has not been established in transplant patients receiving Lansoprazole and MMF. Use Lansoprazole with caution in transplant patients receiving MMF.  See the prescribing information for other drugs dependent on gastric pH for absorption. 



Combination Therapy with Clarithromycin and Amoxicillin



Clinical Impact:  Concomitant administration of clarithromycin with other drugs can lead to serious adverse reactions, including potentially fatal arrhythmias, and are contraindicated. Amoxicillin also has drug interactions. 



Intervention: 


See Contraindications and Warnings and Precautions in prescribing information for clarithromycin.

See Drug Interactions in prescribing information for amoxicillin.





Tacrolimus



 Clinical Impact:Potentially increased exposure of tacrolimus, especially in transplant patients who are intermediate or poor metabolizers of CYP2C19. 



Intervention: Monitor tacrolimus whole blood trough concentrations. Dose adjustment of tacrolimus may be needed to maintain therapeutic drug concentrations. See prescribing information for tacrolimus. 



Interactions with Investigations of Neuroendocrine Tumors



 Clinical Impact:  CgA levels increase secondary to PPI-induced decreases in gastric acidity. The increased CgA level may cause false positive results in diagnostic investigations for neuroendocrine tumors [see Warnings and Precautions (5.7), Clinical Pharmacology (12.2)].



Intervention: Temporarily stop Lansoprazole delayed release capsules treatment at least 14 days before assessing CgA levels and consider repeating the test if initial CgA levels are high. If serial tests are performed (e.g., for monitoring), the same commercial laboratory should be used for testing, as reference ranges between tests may vary. 



Interaction with Secretin Stimulation Test



Clinical Impact: Hyper-response in gastrin secretion in response to secretin stimulation test, falsely suggesting gastrinoma. 



Intervention: Temporarily stop Lansoprazole treatment at least 28 days before assessing to allow gastrin levels to return to baseline [see Clinical Pharmacology (12.2)].



False Positive Urine Tests for THC



 Clinical Impact:  There have been reports of false positive urine screening tests for tetrahydrocannabinol (THC) in patients receiving PPIs. 



Intervention:  An alternative confirmatory method should be considered to verify positive results. 





Table 3. Clinically Relevant Interactions Affecting Lansoprazole Delayed Release Capsules When CoAdministered with Other Drugs





CYP2C19 OR CYP3A4 Inducers



 Clinical Impact:  Decreased exposure of lansoprazole when used concomitantly with strong inducers [see Clinical Pharmacology (12.3)]



Intervention:  St John’s Wort, rifampin: Avoid concomitant use with Lansoprazole.

Ritonavir-containing products: See prescribing information. 



CYP2C19 or CYP3A4 Inhibitors



Clinical Impact:  Increased exposure of lansoprazole is expected when used concomitantly with strong inhibitors [see Clinical Pharmacology(12.3)]. 



Intervention: Voriconazole: See prescribing information. 



Sucralfate



 Clinical Impact:  Decreased and delayed absorption of lansoprazole [see Clinical Pharmacology (12.3)]. 



Intervention :  Take Lansoprazole at least 30 minutes prior to sucralfate [see Dosage and Administration (2.4)]. 



查看完整回答
反对 回复 2023-10-18
?
小唯快跑啊

TA贡献1863条经验 获得超2个赞

要仅获取<p>下的标签7 DRUG INTERACTIONS,您可以使用 CSS 选择器:


import requests

from bs4 import BeautifulSoup



URL = "https://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=00a574e0-bd03-deea-9f85-b108f78982ba"

soup = BeautifulSoup(requests.get(URL).content, "html.parser")


for tag in soup.select(

    "#anch_dj_dj-dj_9, [data-sectioncode='34073-7'] > p:nth-of-type(n+2)"

):

    print(tag.get_text(strip=True))

输出:


7 DRUG INTERACTIONS

Tables 2 and 3 include drugs with clinically important drug interactions and interaction with diagnostics when administered concomitantly with lansoprazole delayed release capsules and instructions for preventing or managing them.

Consult the labeling of concomitantly used drugs to obtain further information about interactions with PPIs.

Table 2. Clinically Relevant Interactions Affecting Drugs Co-Administered with Lansoprazole Delayed Release Capsules and Interactions with Diagnostics

Table 3. Clinically Relevant Interactions AffectingLansoprazole Delayed Release CapsulesWhen CoAdministered with Other Drugs



查看完整回答
反对 回复 2023-10-18
  • 2 回答
  • 0 关注
  • 258 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信