sql语句出错
sql = "INSERT INTO table1(word) VALUES (%s)" % (str)
改为
"INSERT INTO table1(word) VALUES ('%s')" % (str)
只要是values里面的值,都需要加“”