例外:不可用的类型' dict'在Python集中

时间:2017-12-03 02:04:40

标签: python dictionary set

下面的代码给了我一个例外 -

success_set = set()
for r in data:
  try: 
    q3 = "UPDATE tab_urls SET url_uploaded='1', url_uploaded_msg='%s' WHERE url = '%s';" %(r['verbose_msg'], r['url'])
    if conn.Execute(q3):
      success_set.add(r)
      logStr = "SUCCESS! Updated database!"
    else:
      logStr = "ERROR! Couldn't update database!"
    cUploaded += 1
  except Exception, e:
    logStr = "Invalid URL: " + str(r['url']) + " | Exception: " + str(e)
for url in batch_set.difference(success_set):
  q2 = "UPDATE tab_urls SET url_invalid = '1' WHERE url = '%s' AND url_month = 's';" %(url, filename)
  conn.Execute(q2)
  cInvalidURLs += 1

是 -

Invalid URL: <URL> | Exception: unhashable type: 'dict'

谁能告诉我这里我做错了什么,以及如何纠正它?谢谢!

0 个答案:

没有答案