The python sqlite3 update statement does not work

I lost 3 hours and I cannot figure out what I’m doing wrong. Please help. I came to conclusion that it does not pass key as it should in update statement because I don’t receive any error, but i dont get the db updated either.

conn = sqlite3.connect('mov.db')
c = conn.cursor()
old_rows = c.execute('SELECT imdb FROM movies WHERE desc="" and imdb"" and year<"1997"') result="c.fetchall()" for="" row="" in="" result:="" key="row[0]" [2:]="" try:="" #="" get="" a="" movie="" object="" with="" the="" data="" about="" identified="" by="" given="" movieid.="" except="" imdberror,="" e:="" print="" "probably="" you're="" not="" connected="" to="" internet.="" complete="" error="" report:"="" e="" continue="" movie['title']="" if="" movie.has_key('plot="" outline'):="" m="movie['plot" outline']="" c.execute('update="" movies="" set="" desc="?" where="" imdb="?',(m,key))" c.rowcount="" commit="" changes="" and="" close="" everything.="" conn.commit()="" c.close()="" conn.close()
  

You are cutting two characters from the key here, that's why it no longer matches the key in your table:

key = row[0] [2:]
Hello, buddy!稿源:Hello, buddy! (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 后端存储 » The python sqlite3 update statement does not work

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录