Reputation: 2072
I have this string
q="""insert into genres (movieid,%(genre_name)s) values (%(movieid)i,1)""" % {'genre_name': t2, 'movieid': movieid}
but the result of print q
is
) values (1,1)nres (movieid,adventure
instead of
insert into genres (movieid,adventure) values (1,1)
why?
Upvotes: 1
Views: 130
Reputation: 36767
Your movie genre_name
has carriage return.
Example:
q="""insert into genres (movieid,%(genre_name)s) values (%(movieid)i,1)""" % {'genre_name': 'horro\r', 'movieid': 12}
print q
gives:
) values (12,1)res (movieid,horro
You should sanitize your input. It's strange to have a backslash there, but maybe change it to forward slash or make it adventure(r)
.
Upvotes: 6