use regex to search the page one time to get two types of Information

Friedrich Rentsch anthra.norell at bluewin.ch
Fri Aug 19 09:43:40 EDT 2016


On 08/19/2016 09:02 AM, iMath wrote:
> I need to use regex to search two types of Information within a web page, while it seems  searching the page two times rather than one is much time consuming , is it possible to search the page one time to get two or more types of Information?

 >>> r = re.compile ('page|Information|time')
 >>> r.findall ( (your post) )
['Information', 'page', 'page', 'time', 'time', 'page', 'time', 
'Information']

Does that look right?

Frederic





More information about the Python-list mailing list