select_sql = 'select url from baidu_v_tbl'
results = cur_oracle.execute(select_sql)
`enter code here`urls = results.fetchall()
logging.info('start........... ')
for con in urls:
url = con[0]
url_v = ''.join(['https://www.baidu.com/s?wd=', url, '@v']) mongo_records = db_mongo.keywords.find({'url': url_v},{'url': 1, 'keyword': 1}, no_cursor_timeout=True)
mongo_keywords = [key['keyword'] for key in mongo_records if key['keyword']]
這是錯誤:
Traceback (most recent call last): File "from_keywords_into_oracle.py", line 44, in <module> mongo_keywords = [key['keyword'] for key in mongo_records] KeyError: 'keyword'
你能縮進/格式化代碼:
您可以通過更換? –