我想使用Python识别字符串中的所有TIMEX3值。例如,如果我的字符串是:
Ecole Polytechnique, maar hij bleef daar slechts tot <TIMEX3 tid="t5" type="DATE" value="1888">1888</TIMEX3>.
Daarna had hij een korte carriere bij het leger als officier d'artillerie in <TIMEX3 tid="t6" type="DATE" value="1889">1889</TIMEX3>
我想把名单拿回来
["1888", "1889"]
到目前为止,我尝试使用xml.eTree.ElementTree文件,但这会导致我的数据崩溃,并出现解析错误-格式不正确,令牌消息无效。我在想也许我可以用正则表达式来避免这种情况?非常感谢您的帮助,谢谢!你知道吗
你可以用BeautifulSoup。你知道吗
如果要使用正则表达式,可以执行以下操作:
不过,以阿维纳什·拉吉(Avinash Raj)为例,使用BeautifulSoup,效果会更好。你知道吗
相关问题 更多 >
编程相关推荐