On May 30, 11:35 am, Lawrence D'Oliveiro <l...@geek- central.gen.new_zealand> wrote: > In message <0dcfcb4a-8844-420b-b2e2- > > c8e684197...@p6g2000pre.googlegroups.com>, John Machin wrote: > > If you need to escape % or _ in a LIKE argument, do whatever the host > > convention is. > > E.g. you are searching for text that contains literally "5% discount", > > with SQLite you could do: > > [avoiding backslashes and concomitant confusion] > > LIKE '%5~% discount%' ESCAPE '~' > > on the command line, so using DB-API: > > like_expr = user_input.replace("~", "~~").replace("%", "~%").replace > > (etc etc) > > Sounds like an amazingly complicated, roundabout and not even reliable way > of doing it.
Please (a) explain what you mean (b) suggest a better way. -- http://mail.python.org/mailman/listinfo/python-list