Norman Khine, 02.02.2010 10:16: > get_record = re.compile(r"""openInfoWindowHtml\(.*?\\ticon: myIcon\\n""") > get_title = re.compile(r"""<strong>(.*)<\/strong>""") > get_url = re.compile(r"""a href=\"\/(.*)\">En savoir plus""") > get_latlng = re.compile(r"""GLatLng\((\-?\d+\.\d*)\,\\n\s*(\-?\d+\.\d*)\)""") > > records = get_record.findall(data) > block_record = [] > for record in records: > namespace = {} > titles = get_title.findall(record) > for title in titles: > namespace['title'] = title
I usually go one step further: find_all_titles = re.compile(r"""<strong>(.*)<\/strong>""").findall for record in records: titles = find_all_titles(record) Both faster and more readable (as is so common in Python). Stefan _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor