Home > Enterprise >  scrapy get integer from string
scrapy get integer from string

Time:10-31

I would like to get "2" from below string by scrapy but however I could not get "2"

In [502]: response.css("a.font-size-4.p-15.collapsed::text")[1].getall()

Out[502]: ['\n\t\t\t\t\t\t\tYorumlar (2)\n\t\t\t\t\t\t']

CodePudding user response:

Try:

''.join([ x.strip().replace('Yorumlar','').replace('(','').replace(')','') for x in response.css("a.font-size-4.p-15.collapsed::text")[1].getall()])
  • Related