Escaping confusion with Python 3 + MySQL

Νίκος Βέργος me.on.nzt at gmail.com
Sun Mar 26 09:41:31 EDT 2017


Ths is the whole snippert i'am trying so you can see what i'm tryong to do.

[code]
		# if bot is contained in hostname update all previous database bot hostname entries with current bot hostname
		for bot in bots:
			if bot in host:
				domain = '.'.join( host.split('.')[-2:] )

				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) )
				if cur.rowcount():
					botfound = True
					break
[/code]

As if i have a syntactical error in someplace which i'am faling to see or PyMySQL wants special treatment regarding escaping special characters.


More information about the Python-list mailing list