[ActivePython 18.104.22.168] Why does Python not return first line?
nospam at nospam.com
Mon Mar 16 01:25:01 CET 2009
On Mon, 16 Mar 2009 01:14:00 +0100, Gilles Ganault <nospam at nospam.com>
>I'm stuck at why Python doesn't return the first line in this simple
Found it: Python does extract the token, but displaying it requires
removing hidden chars:
response = "<span>Address :</span></td>\r\t\t<td>\r\t\t\t3 Abbey Road,
St Johns Wood <br />\r\t\t\tLondon, NW8 9AY\t\t</td>"
re_address = re.compile('<span>Address
:</span></td>.+?<td>(.+?)</td>',re.I | re.S | re.M)
address = re_address.search(response)
address = address.group(1).strip()
for item in ["\t","\r"," <br />"]:
address = address.replace(item,"")
print "address is %s" % address
print "address not found"
More information about the Python-list