2007年12月27日 星期四 11:02
表结构 CREATE TABLE people ( name_last varchar(20), age integer ); 以下是SQL语句 # -*- coding: utf-8 -*- #from pysqlite2 import dbapi2 as sqlite import sqlite con=sqlite.connect("xn.db") cur=con.cursor() #cur.execute("SELECT * FROM item_type where code >5") newPeople=( ('Lebed',53), ('Zhirinovsky',57), ) #for person in newPeople: # cur.execute("INSERT INTO people (name_last,age) VALUES (?,?)",person) cur.execute("INSERT INTO people (name_last) VALUES (?)",str("aa")) con.commit() #data = cur.fetchall() #for i in data: # print i # #cur.close() Traceback (most recent call last): File "D:\workspace\wx\src\consqlite.py", line 17, in ? cur.execute("INSERT INTO people (name_last) VALUES (?)",str("aa")) File "C:\Python24\Lib\site-packages\sqlite\main.py", line 255, in execute self.rs = self.con.db.execute(SQL % parms) TypeError: not all arguments converted during string formatting -- , ," 1+ /( )`" 1+ \ \___ / |" 1+ /- _ `-/ '" 1+ (/\/ \ \ /\" 1+ / / | ` \" 1+ O O ) / |" 1+ `-^--'`< '" 1+ (_.) _ ) /" 1+ `.___/` /" 1+ `-----' /" 1+ <----. __ / __ \" 1+ <----|====O)))==) \) /====" 1+ <----' `--' `.__,' \" 1+ | |" 1+ \ / /\" 1+ ______( (_ / \______/" 1+ ,' ,-----' |" 1+ `--{__________)"
2007年12月27日 星期四 11:22
python-chinese£¬ÄãºÃ ÕâÑùд¾Í¿ÉÒÔÁË¡£ cur.execute("INSERT INTO people (name_last) VALUES (?)",(str("aa"),)) nmweizi£¬nmweizi在163.com 2007-12-27 ----- Original Message ----- From: ÂÀÐÂÖ¾ To: python-chinese Sent: 2007-12-27, 11:02:45 Subject: [python-chinese] pysqlite2ÎÞ·¨ÍùÊý¾Ý¿â½ÓÈëÊý¾Ý£¬ÇëÖ¸µã ±í½á¹¹ CREATE TABLE people ( name_last varchar(20), age integer ); ÒÔÏÂÊǣӣѣÌÓï¾ä # -*- coding: utf-8 -*- #from pysqlite2 import dbapi2 as sqlite import sqlite con=sqlite.connect("xn.db") cur=con.cursor() #cur.execute("SELECT * FROM item_type where code >5") newPeople=( ('Lebed',53), ('Zhirinovsky',57), ) #for person in newPeople: # cur.execute("INSERT INTO people (name_last,age) VALUES (?,?)",person) cur.execute("INSERT INTO people (name_last) VALUES (?)",str("aa")) con.commit() #data = cur.fetchall() #for i in data: # print i # #cur.close() Traceback (most recent call last): File "D:\workspace\wx\src\consqlite.py", line 17, in ? cur.execute("INSERT INTO people (name_last) VALUES (?)",str("aa")) File "C:\Python24\Lib\site-packages\sqlite\main.py", line 255, in execute self.rs = self.con.db.execute(SQL % parms) TypeError: not all arguments converted during string formatting -- , ," 1+ /( )`" 1+ \ \___ / |" 1+ /- _ `-/ '" 1+ (/\/ \ \ /\" 1+ / / | ` \" 1+ O O ) / |" 1+ `-^--'`< '" 1+ (_.) _ ) /" 1+ `.___/` /" 1+ `-----' /" 1+ <----. __ / __ \" 1+ <----|====O)))==) \) /====" 1+ <----' `--' `.__,' \" 1+ | |" 1+ \ / /\" 1+ ______( (_ / \______/" 1+ ,' ,-----' |" 1+ `--{__________)" _______________________________________________ python-chinese Post: send python-chinese在lists.python.cn Subscribe: send subscribe to python-chinese-request在lists.python.cn Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn Detail Info: http://python.cn/mailman/listinfo/python-chinese -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071227/45667ee6/attachment.htm
2007年12月28日 星期五 11:13
python-chinese£¬ÄãºÃ ÕâÑùд¾Í¿ÉÒÔÁË¡£ cur.execute("INSERT INTO people (name_last) VALUES (?)",(str("aa"),)) nmweizi在gmail.com£¬nmweizi在gmail.com 2007-12-27 ----- Original Message ----- From: ÂÀÐÂÖ¾ To: python-chinese Sent: 2007-12-27, 11:02:45 Subject: [python-chinese] pysqlite2ÎÞ·¨ÍùÊý¾Ý¿â½ÓÈëÊý¾Ý£¬ÇëÖ¸µã ±í½á¹¹ CREATE TABLE people ( name_last varchar(20), age integer ); ÒÔÏÂÊǣӣѣÌÓï¾ä # -*- coding: utf-8 -*- #from pysqlite2 import dbapi2 as sqlite import sqlite con=sqlite.connect("xn.db") cur=con.cursor() #cur.execute("SELECT * FROM item_type where code >5") newPeople=( ('Lebed',53), ('Zhirinovsky',57), ) #for person in newPeople: # cur.execute("INSERT INTO people (name_last,age) VALUES (?,?)",person) cur.execute("INSERT INTO people (name_last) VALUES (?)",str("aa")) con.commit() #data = cur.fetchall() #for i in data: # print i # #cur.close() Traceback (most recent call last): File "D:\workspace\wx\src\consqlite.py", line 17, in ? cur.execute("INSERT INTO people (name_last) VALUES (?)",str("aa")) File "C:\Python24\Lib\site-packages\sqlite\main.py", line 255, in execute self.rs = self.con.db.execute(SQL % parms) TypeError: not all arguments converted during string formatting -- , ," 1+ /( )`" 1+ \ \___ / |" 1+ /- _ `-/ '" 1+ (/\/ \ \ /\" 1+ / / | ` \" 1+ O O ) / |" 1+ `-^--'`< '" 1+ (_.) _ ) /" 1+ `.___/` /" 1+ `-----' /" 1+ <----. __ / __ \" 1+ <----|====O)))==) \) /====" 1+ <----' `--' `.__,' \" 1+ | |" 1+ \ / /\" 1+ ______( (_ / \______/" 1+ ,' ,-----' |" 1+ `--{__________)" _______________________________________________ python-chinese Post: send python-chinese在lists.python.cn Subscribe: send subscribe to python-chinese-request在lists.python.cn Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn Detail Info: http://python.cn/mailman/listinfo/python-chinese -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071228/74ee6eda/attachment.html
Zeuux © 2024
京ICP备05028076号