python/ regex

I'm having a bit of trouble with a regular expression in python. The html string is:

 html = <td style="padding-right:5px;"> <span class="blackText">Above £ 7.00 = </span> </td> <td> <span class="blackText"> <p>Free</p> </span> </td> 

I want to extract the "7.00" and "Free", however the following does not work:

amount = re.findall(r'Above £ (.*?) =',html)

Python throws up a non-ASCII error for the £ symbol. How would I get around this? Thanks.

amount = re.findall(r'Above \xC2 (.*?) =', html)

暂无
暂无

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question Regular expression that finds and replaces non-ascii characters with Python How to include Non-ascii characters in regular expression in Python Convert non-ascii character to ascii character Django: Non-ASCII character SyntaxError: Non-ASCII character python syntax error : non-ascii character SyntaxError: Non-ASCII character '\xe2' Help Replacing Non-ASCII character in Python SyntaxError: Non-ASCII character. Python How to detect non-ASCII character in Python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM