擅长:python、mysql、java
<p>如果要使用正则表达式,可以执行以下操作:</p>
<pre><code>>>> import re
>>> s = """
... 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>"""
>>> result = re.findall(r'value="([\d]+)', s)
>>> result
['1888', '1889']
>>>
</code></pre>
<p>不过,以阿维纳什·拉吉(Avinash Raj)为例,使用BeautifulSoup,效果会更好。你知道吗</p>