Q:

If statement scrapy xpath not working

Alright so I'm trying to match the result of an xpath selection against a few strings but I think I'm not getting the right result from the selection.
My code is the following:
def parse_item(self, response):

    for sel in response.xpath('//*[@id="tab:specificaties"]'):
        category = sel.xpath('table/tbody/tr[2]/td[2]/a/text()').extract()
        logging.warning(category)
        if category == "Videokaarten":
            logging.warning("Videokaart")
        elif category == "Geheugen intern":
            logging.warning("Geheugen")
        elif category == "Moederborden":
            logging.warning("Moederbord")
        elif category == "Behuizingen":
            logging.warning("Behuizing")
        elif category == "Processors":
            logging.warning("Processor")
        elif category == "Voedingen":
            logging.warning("Voeding")
        elif category == "Processorkoeling":
            logging.warning("Processorkoeling")
        elif category == "Barebones":
            logging.warning("Barebone")

So what I'm trying to do is check if the category matches the strings stated above and if so handle accordingly. The logging is only for checking the value of category which returns
WARNING:root:[]

in my terminal. 
I hope somebody can shed some light on the case. Thanks in advance!

A:

Normally when you extract from xpath, it returns the result in a list, you may try changing your if ... == statement to if ... in ...:, something like this:
if "Videokaarten" in category:
    logging.warning("Videokaart")
elif "Geheugen intern" in category:
...

Hope this helps.

