我正在使用beautifulsoup4解析数千个html页面。我很难找到每个ID的内容并替换它。我上传的示例将帮助您理解我遇到的问题
我拥有的html页面的一个简单示例是
<derivativeHolding>
<securityTitle>
<value>Performance Shares</value>
</securityTitle>
<conversionOrExercisePrice>
<footnoteId id="F3"/>
</conversionOrExercisePrice>
</derivativeHolding>
<derivativeHolding>
<securityTitle>
<value>Stock Option (Right to Buy)</value>
</securityTitle>
<conversionOrExercisePrice>
<value>35.57</value>
</conversionOrExercisePrice>
</derivativeHolding>
<footnotes>
<footnote id="F3">contents</footnote>
</footnotes>
我想替换“footnoteId^{id1}”$
我不知道如何更换零件,所以我没有准备代码
我希望csv文件中的结果是这样的
其中第一行是变量名列表
示例解决方案仅显示了查找脚注(如果脚注被引用)的方法:
如果html结构稍有变化,则很可能需要对此进行微调,以避免在数千个页面中的许多页面上出现中断
相关问题 更多 >
编程相关推荐