2016-03-11 43 views
0

我有一个很长的字符串,它包含除了其他字符,甚至电子邮件地址。python:使用正则表达式和findall搜索

由于是:

>>> s= “fedcantona datto, ernest william, pasquale <b>lops</b>, till plbaum, ...pasqale. <b>email</b>: [email protected] pagina web personale: http://.www. do. aggigi .il ...fanei ana tel: +34-54285, e-<b>mail</b>: [email protected] .impedovo ... <b>lops</b> pale, tel: +9-54285, e-<b>mail</b>: <b>lops</b>, g semo, p .bile ... b mehta, c niederee, a stewart, m demm” 

我想有作为输出字符串的第一个电子邮件地址,我唯一知道的事情是,所有的电子邮件地址以“@ gmail.com”结尾。 我写了这个:

>>> print re.findall("(%s)(@gmail.it)", s)[0] 

但它不工作,我做错了什么?

回答