A
Amy G
I am trying to execute the following MySQL query:
c.execute("""DELETE FROM pending WHERE userid=%s AND subject LIKE '%%s%'"""
%(userid, phrase))
This returns an error saying:
ValueError: unsupported format character ''' (0x27) at index 63
I can fix this by setting
phrase = "%" + phrase + "%"
and then
c.execute("""DELETE FROM pending WHERE userid=%s AND subject LIKE '%s'"""
%(userid, phrase))
But is there a way to escape the % signs in the first execute statement?
Thanks in advance for any help.
Sorry about the easy question.
c.execute("""DELETE FROM pending WHERE userid=%s AND subject LIKE '%%s%'"""
%(userid, phrase))
This returns an error saying:
ValueError: unsupported format character ''' (0x27) at index 63
I can fix this by setting
phrase = "%" + phrase + "%"
and then
c.execute("""DELETE FROM pending WHERE userid=%s AND subject LIKE '%s'"""
%(userid, phrase))
But is there a way to escape the % signs in the first execute statement?
Thanks in advance for any help.
Sorry about the easy question.