我正在使用Python读取HTML数据,但我很难从该HTML中找到“d:Title>;从优秀到卓越<;/d:Title>;”之间的所有子字符串
data = "<html><head></head><body><pre style='word-wrap': break-word; white-space: pre-wrap;
d:Title>Good To Great</d:Title>d:ComplianceAssetId m:null='true'/>
d:Title>War and Peace</d:Title>/d:ComplianceAssetId m:null='false'/>
d:Title>The Great Gatsby</d:Title>/entry></feed></pre></body></html>"
预期产出:
['Good To Great', 'War and Peace', 'The Great Gatsby']
我怀疑regex可能是一个解决方案,但我对regex的了解有限(仍在学习),有人能帮我解决这个问题吗
提前感谢你的帮助
可以使用通配符
.
查找文本正则表达式是
'Title>([\w\s]+)</d:Title'
Python版本3.7。我希望这有帮助
相关问题 更多 >
编程相关推荐