1
で正規表現(RE)の重複結果を削除する方法
文字列があります:は、Python
str = 'Please Contact Prof. Zheng Zhao: <a href="mailto:[email protected]">[email protected]</a> for details, or our HR: [email protected]'
私はその文字列内の電子メールのすべてを解析したかったので、私は設定:
p = r'[\w\.][email protected][\w\.]+'
re.findall(p, str)
結果は次のとおりです。
['[email protected]', '[email protected]', '[email protected]']
明らかに、最初と2番目が重複しています。これをどうやって防ぐか?