Split String with unicode and backslash with Python
Question: I am experiencing trouble extracting a float from a string. The string is the
output of webscraping:

    
    
    input = u'<strong class="ad-price txt-xlarge txt-emphasis " itemprop="price">\r\n\xa3450.00pw</strong>'
    

I want to get:

`output: 3450.00`

but I didn't find a way to do it. I have tried to extract it with the split /
replace functions:

    
    
    word.split("\xa")
    word.replace('<strong class="ad-price txt-xlarge txt-emphasis " itemprop="price">\r\n\xa','')
    

I tried to use the `re` library. It does not work as well, it only extract
`450.00`

    
    
    import re
    num = re.compile(r'\d+.\d+')
    num.findall(word)
    [u'450.00']
    

Thus, I still have the same problem in the end with the `\` Do you have an
idea ?


Answer: `\xa3` is the pound sign.

    
    
    import unidecode 
    print unidecode.unidecode(input)
    
    <strong class="ad-price txt-xlarge txt-emphasis " itemprop="price">
    PS450.00pw</strong>
    

To get the number from that, you better use regex:

    
    
    import re
    num = re.compile(r'\d+.\d+')
    num.findall(input)[0]
    

**Result**

    
    
    '450.00'
    

