Help with MySQLdb Please

Bill Carter BC at
Tue Oct 22 01:02:09 CEST 2002

On Mon, 21 Oct 2002 14:08:09 -0500, John Hunter
<jdhunter at> wrote:

>>>>>> "Bill" == Bill Carter <BC at> writes:
>    Bill> That work just like I want it to work, But the same example
>    Bill> in python returns "errortype" errors.
>    Bill> Python: userinput = "123" cursor.execute(" SELECT t.col1,
>    Bill> t.col2, t.col3 from test as t where t.col2 LIKE '%%%s%%',
>    Bill> (userinput))
>I am not sure why the %% quoting is not working in the mysql format
>string, and I'm sure someone else can give you guidance there.  As a
>quick work around, you can just use python's string formatting
>q = "SELECT blah,blah1 from test where col LIKE '%%%s%%'" % userinput
>as long as the default string conversion of userinput is OK.


That work around did work perfectly


More information about the Python-list mailing list