escaping % in a string???
From: Amy G (amy-g-art_at_cox.net)
Date: 02/27/04
- Next message: Wolfram Kraus: "Re: escaping % in a string???"
- Previous message: Jive Dadson: "wxPython tutorial?"
- Next in thread: Wolfram Kraus: "Re: escaping % in a string???"
- Reply: Wolfram Kraus: "Re: escaping % in a string???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 26 Feb 2004 23:12:47 -0800
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.
- Next message: Wolfram Kraus: "Re: escaping % in a string???"
- Previous message: Jive Dadson: "wxPython tutorial?"
- Next in thread: Wolfram Kraus: "Re: escaping % in a string???"
- Reply: Wolfram Kraus: "Re: escaping % in a string???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|