Я хочу проверить, установлено ли поле в элементе Scrapy.Но я использую has_key
для элемента, я получаю эту ошибку:
Traceback (most recent call last):
File "d:\python27\lib\site-packages\twisted\internet\defer.py", line 653, in _runCallbacks
current.result = callback(current.result, *args, **kw)
File "D:\Kerja\HIT\Python Projects\<project_name>\<project_name>\<project_name>\pipelines.py", line 16, in process_item
self.listing_process.process_new_or_update(item)
File "D:\Kerja\HIT\Python Projects\<project_name>\<project_name>\<project_name>\processor.py", line 290, in process_new_or_update
listing = self.listing_check.normalize_for_process(listing)
File "D:\Kerja\HIT\Python Projects\<project_name>\<project_name>\<project_name>\processor.py", line 213, in normalize_for_process
if listing.has_key('description'):
File "d:\python27\lib\site-packages\scrapy\item.py", line 74, in __getattr__
raise AttributeError(name)
AttributeError: has_key
Как я могу проверить, установлено ли поле без использования has_key?