Scrapy to different Item separate storage

Object judgment in Piperlines,

def process_item(self, item, spider):
    if item.__class__ == BaseItem :
    else item.__class__ == BookItem:
    return item 

This object can also be written judgment 

isinstance(item,BaseItem)  #The inherited class will be True, and the __class__ must be a class

type(item)Only the built-in objects can be used.

Posted by Gladys at November 13, 2013 - 12:16 PM