如何使用Python从xml文件中的特定节点类型提取文本

时间:2018-10-16 11:47:45

标签: python-3.x xml-parsing

[仅当每个SYNONYM标签的文字之一包含至少一个多字表达式的文字,即包含“ _”(例如,“ fulg_de_nea”)时,才如何从LITERAL标签中提取文本? ] [1]

<SYNSET>
	<POS>n</POS>
	<SYNONYM>
		<LITERAL>discontinuitate<SENSE>1.1</SENSE></LITERAL>
		<LITERAL>intermitență<SENSE>3</SENSE></LITERAL>
	</SYNONYM>
	<DOMAIN>factotum</DOMAIN>
</SYNSET>
<SYNSET>
	<POS>n</POS>
	<SYNONYM>
		<LITERAL>fulg<SENSE>3</SENSE></LITERAL>
		<LITERAL>fulg_de_nea<SENSE>1</SENSE></LITERAL>
		<LITERAL>fulg_de_zăpadă<SENSE>1</SENSE></LITERAL>
	</SYNONYM>
	<DOMAIN>chemistry</DOMAIN>
</SYNSET>

0 个答案:

没有答案