i thank you all, first of al ill change my dictinary variable name :)
then ill use %s and %d . and thanks for other examples,these examples
enchance my python-way thinking. :)
On 8/12/05, Scott David Daniels <[EMAIL PROTECTED]> wrote:
> Paolino wrote:
> > sinan . wrote:
> >
> >> hi all,
> >> i hav
Paolino wrote:
> sinan . wrote:
>
>> hi all,
>> i have a string and int values in same dictionary like this
>> dict = {'str_name': 'etc' , 'int_name' : 112 }
Bad idea to call this "dict" -- that is a system-defined name
for the dictionary type. I'll use "holder" below.
>> the error occures when d
I just did this sort of thing the other day!
Your database only accepts ints for BH, but remember, you are building
an SQL *string* to be executed. To show SQL that your BH value is an
int, not a string, do not enclose it in quotes.
(Another style hint: don't name dict's "dict", as this will mas
sinan . wrote:
> hi all,
> i have a string and int values in same dictionary like this
> dict = {'str_name': 'etc' , 'int_name' : 112 }
> the error occures when do this
> SQL = "INSERT INTO (`AH`, `BH` ) VALUES ('" + dict['str_name'] + "',
> '" + dict['int_name'] + "')"
> cursor.execute(SQL)
> pyth
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 "", line 1, in -toplevel-
SQL = "INSERT INTO (`AH`, `BH` ) VAL
hi all,
i have a string and int values in same dictionary like this
dict = {'str_name': 'etc' , 'int_name' : 112 }
the error occures when do this
SQL = "INSERT INTO (`AH`, `BH` ) VALUES ('" + dict['str_name'] + "',
'" + dict['int_name'] + "')"
cursor.execute(SQL)
python does not accep dict['int_nam