0
我在做數據庫的東西,我有這樣的代碼爲什麼這個'except:'行拋出語法錯誤?
for res_posts in list_of_response_ids:
temp_str = res_posts[0] # first element of res_posts tuple is string
temp_str += ":" + output
try:
cursor.execute("INSERT INTO POST (res_post_id) where post_id = '%s';" % (temp_str, res_posts(1))
except:
print "life sucks"
db.close()
語法錯誤被拋出,像這樣:
$ python post.cgi
File "post.cgi", line 85
except:
^
SyntaxError: invalid syntax
這究竟是爲什麼?如果您需要更多信息,我可以發佈更多代碼。
謝謝!
標準過程中,您沒有得到:回去線,檢查你的括號。 – user2357112
這是一個好主意,我會牢記這一點。謝謝! – Azhraam