insert string problems..
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Sun Oct 28 03:45:21 EDT 2007
On Sun, 28 Oct 2007 00:24:34 -0700, Abandoned wrote:
> Hi..
> I want to insert some data to postgresql.. My insert code:
> yer="019"
> cursor.execute("INSERT INTO ids_%s (id) VALUES (%s)", (yer, id)) I don't
> want to use % when the insert operation.
>
> in this code give me this error:
> psycopg2.ProgrammingError: syntax error at or near "'019'" LINE 1:
> SELECT link_id from linkkeywords_'019'
>
> if i do int(yer) , 019 change to 19 .. How can i do int yer string with
> 0 ?
Integers with a leading 0 are interpreted as base 8 (octal). You can't
write 019, because there is no digit "9" in octal.
Why do you need a leading zero?
--
Steven.
More information about the Python-list
mailing list