dealing with special characters in Python and MySQL
ronrsr
ronrsr at gmail.com
Mon Dec 18 01:35:02 EST 2006
structure for the DB:
CREATE TABLE `zingers` (
`zid` int(9) unsigned NOT NULL auto_increment,
`keywords` varchar(255) default NULL,
`citation` text,
`quotation` text,
PRIMARY KEY (`zid`)
) ENGINE=MyISAM DEFAULT CHARSET=UTF8 AUTO_INCREMENT=422 ;
code for storing to database:
querystring = "update zingers set keywords = '%s', citation =
'%s', quotation = %s' where zid = %d" %
(keywords,citation,quotation,zid)
;
cursor.execute(querystring)
at this point, querystring = update zingers set keywords = '
aaaaaa;Action', citation = '''''''''
', quotation = '''''''''''''
' where zid = 422
where '''' are an assortment of apostrophes and single quotes copied
and pasted from a Word Document.
>
> And where is the actual code... What you've supplied doesn't show
> how you are generating the SQL...
> --
More information about the Python-list
mailing list