我有这个示例xml文件
<page>
<title>Chapter 1</title>
<content>Welcome to Chapter 1</content>
</page>
<page>
<title>Chapter 2</title>
<content>Welcome to Chapter 2</content>
</page>
Run Code Online (Sandbox Code Playgroud)
我想提取标题标签和内容标签的内容.
使用模式匹配或使用xml模块,哪种方法可以提取数据.或者有更好的方法来提取数据.
我从HTML页面中提取了一组数据并复制到变量中.变量看起来像
names='''
Apple
Ball
Cat'''
Run Code Online (Sandbox Code Playgroud)
现在我想将每一行加入到列表中,以便我可以访问我想要的任何行.有没有办法在Python中做到这一点