Escaping confusion with Python 3 + MySQL
moorthy.rs at gmail.com
moorthy.rs at gmail.com
Wed Apr 22 01:48:43 EDT 2020
On Sunday, March 26, 2017 at 7:55:09 PM UTC+5:30, Νίκος Βέργος wrote:
> Τη Κυριακή, 26 Μαρτίου 2017 - 5:19:27 μ.μ. UTC+3, ο χρήστης Ian έγραψε:
>
> > You need to change the placeholders back. The poster who told you to
> > replace them was misinformed.
>
> okey altered them back to
>
> cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros, browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%%s%" ''',
> (pID, domain, ref, location, useros, browser, lastvisit, domain) )
>
> but now the problem is how to exact;y type the Where HOST like "%%%"
>
> I MEAN HOW TO DIFFERENTIATE '%S' FROM LITERAL '%' character.
Hi ,
I have fixed this issue on other way
you can declare variables like below and pass same to the query with strings.
per1="%%%"
you can assign this string (WHERE host LIKE "%%s%" ,per1) to avoid this issue.
same way i resolved my query execution on cursor execute.
More information about the Python-list
mailing list