我发现类似我想问的问题,但答案从来没有给我一个解决方案。我在python上使用mysql语法时遇到问题。这是我的代码:
data_details = cursor.execute("""INSERT INTO url_detail VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)""",
(
0,str(display_url),str(node_text),str(shortcode),str(comment_count),str(dimensions_height),str(dimensions_width),str(liked_by_count),str(owner_id),str(video_url),str(taken_at_timestamp),str(final_hashtag)
))
我也尝试过:
data_details = cursor.execute("""INSERT INTO url_detail(0,str(display_url),str(node_text),str(shortcode),str(comment_count),str(dimensions_height),str(dimensions_width),str(liked_by_count),str(owner_id),str(video_url),str(taken_at_timestamp),str(final_hashtag)) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)""",
(
0,str(display_url),str(node_text),str(shortcode),str(comment_count),str(dimensions_height),str(dimensions_width),str(liked_by_count),str(owner_id),str(video_url),str(taken_at_timestamp),str(final_hashtag)
))
但结果仍然是错误的。实际上我最后一次尝试:
data_details = cursor.execute("""INSERT INTO url_detail(0,str(display_url)) VALUES (%s,%s)""",
(
0,str(display_url)
))
我的最后一个代码是它的工作,但我想要两个以上的变量。