我想将file_name和目录结合起来,使用Python插入到MySql表中。
代码
cursor.execute("Insert INTO library (book_name, author, written, book_link, images) VALUES (%s, %s, %s, 'library/'%s, 'images/'%s )" , (book_name, author, written, book_link, images))
给了我不需要的单引号'
符号,如下所示:
images/'me ibrary/'my life
如何避免这种错误的语法?