小编Blu*_*Ice的帖子

在python中解析xml

我想解析xml文件中的文本.考虑到我在file.xml中有一些行

<s id="1792387-2">Castro Verde is situated in the Baixo Alentejo Subregion within a territory known locally as the Campo Branco (English: White Plains).</s>
Run Code Online (Sandbox Code Playgroud)

如何从上面的行中提取以下文本:

Castro Verde is situated in the Baixo Alentejo Subregion within a territory known locally as the Campo Branco (English: White Plains).
Run Code Online (Sandbox Code Playgroud)

在对文本进行一些更改后,我希望返回带有相同标记的更改文本,如下所示.

<s id="1792387-2"> Changed Text </s>
Run Code Online (Sandbox Code Playgroud)

请任何建议.谢谢!

python xml-parsing

2
推荐指数
1
解决办法
1527
查看次数

标签 统计

python ×1

xml-parsing ×1