此处我尝试使用article_link
删除文档:x
>>> db = client.article_db
>>> collection1 = db.article0510
>>> collection1.remove('article_link': 'http://www.moneycontrol.com/news/stocks-views/bet-for-long-termbharat-forge-hemant-thukral_3414941.html')
File "<stdin>", line 1
collection1.remove('article_link': 'http://www.moneycontrol.com/news/stocks-views/bet-for-long-termbharat-forge-hemant-thukral_3414941.html')
^
SyntaxError: invalid syntax
这是我的python脚本:
bse_tagged_link = ['http://www.business-standard.com/article/finance/sfio-probes-10-firms-in-bob-case-115102900994_1.html']
for link in bse_tagged_link:
lookup_result = self.collection1.find({'article_link': link})
print lookup_result
for val in lookup_result:
if val and val != 'None':
print val
self.collection1.remove({'article_link': var['article_link']})
我想做的是:
1
查找链接到表2 答案 0 :(得分:2)
您remove
的语法不正确,正如您所犯的错误所显示的那样。
您应该使用以下语法:
collection1.remove({"article_link" : "http://www.moneycontrol.com/news/stocks-views/bet-for-long-termbharat-forge-hemant-thukral_3414941.html"})