I am trying to use the python 2.5 string formatting however I have run into problem in the following example:
values = {
'url': 'http://blabla.com',
'link' : 'http://blabla.com',
'username' : 'user',
'spot' : 0,
'views' : 10,
'date' : 3232312,
'private' : 1,
}
query = """insert into hyves.Image (URL, StaticLink , HostUsername, SpotCount, ViewCount, UploadDate) values ('%(url)','%(link)','%(username)',%(spot),%(views),%(date), %(private) )""" % values
print query
It gives me the following error:ValueError: unsupported format character ''' (0x27) at index 106. Can anyone help me?