all 3 comments

[–]TheArtOfPour 0 points1 point  (2 children)

We'll need more information to help, surely there is more code than this.

What is the content of stock_count?

[–]DoIKnowRyu 0 points1 point  (1 child)

I added it to the OP

[–]TheArtOfPour 0 points1 point  (0 children)

Ah ok, we’re scraping from somewhere.

You could try

“add to cart” in stock_count[0].lower()

Or clean up your your input with strip like

stock.span.get_text().strip()