Silly/crazy problem with sqlite

Chris Green cl at isbd.net
Fri Nov 24 16:10:08 EST 2023


Chris Green <cl at isbd.net> wrote:
> This is driving me crazy, I'm running this code:-

OK, I've found what's wrong:-

>         cr.execute(sql, ('%' + "2023-11" + '%'))

should be:-

    cr.execute(sql, ('%' +  x + '%',) )


I have to say this seems very non-pythonesque to me, the 'obvious'
default simply doesn't work right, and I really can't think of a case
where the missing comma would make any sense at all.

Maybe I've had too much to eat and drink tonight! :-)

-- 
Chris Green
·


More information about the Python-list mailing list