I am learning natural language processing. I need to store a list e.g.["We","aren't","friends","."] to MySQL table's column, so that when i want to analyse it, i could read it from the database. Part of my code is :
tokenized_text = nltk.word_tokenize(line)
sql2 = 'update training_data set tokenized_essay = "{0}" where filename = "{1}"'.format(tokenized_text,res)
cursor.execute(sql2)
_mysql_exceptions.ProgrammingError: (1064, 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version.
I have set the column tokenized_text as longtext. I have tried json,pickle library,but it seems that the problem is how to escape the single quote.e.g."aren't" Please help me!