Use substitution like below.
Hope this helps
py> d = {'str_name': 'etc' , 'int_name' : 112 }
py> SQL = "INSERT INTO (`AH`, `BH` ) VALUES ('" + d['str_name'] + "',
'" + d['int_name'] + "')"
Traceback (most recent call last):
File "<pyshell#1>", line 1, in -toplevel-
SQL = "INSERT INTO (`AH`, `BH` ) VALUES ('" + d['str_name'] + "',
'" + d['int_name'] + "')"
TypeError: cannot concatenate 'str' and 'int' objects
py> SQL = "INSERT INTO (`AH`, `BH` ) VALUES ('%s', %d)" %
(d['str_name'], d['int_name'])
py> print SQL
INSERT INTO (`AH`, `BH` ) VALUES ('etc', 112)
py>
--
http://mail.python.org/mailman/listinfo/python-list