How do i remove all character besides digits and "," from unicode string in python?
Question: I'm writing small crawler using scrapy. One of XPath's is containing price
followed by "zł" (polish currency mark) the problem is it's obfuscated by new
line characters, spaces and non breaking spaces. so when I do :

    
    
    sel.xpath("div/div/span/span/text()[normalize-space(.)]").extract()
    

I get:

    
    
    [u'\n            1\xa0740,00 z\u0142\n            \n            \n                ']
    

Which I want to change to

    
    
    [u'1740,00']
    

or simply into float variable. What is the /best/simplest/fastest way to do
this?


Answer: You can use `re.findall` to extract the characters from the string:

    
    
    >>> import re
    >>> s = u'\n            1\xa0740,00 z\u0142\n            \n            \n            '
    >>> L = re.findall(r'[\d,]', s)
    >>> "".join(L)
    '1740,00'
    

