标签:style blog http io color os ar 使用 for
import sqlite3 conn = sqlite3.connect(‘example.db‘)#如果要在RAM中创建db,可以使用特定名字:memory:
c=conn.cursor() # Never do this -- insecure! symbol = ‘RHAT‘ c.execute("SELECT * FROM stocks WHERE symbol = ‘%s‘" % symbol) # Do this instead,注意元组中只有一个元素时后面要有逗号 #sql语句中的替换符为? t = (‘RHAT‘,) c.execute(‘SELECT * FROM stocks WHERE symbol=?‘, t) print(c.fetchone()) # Larger example that inserts many records at a time purchases = [(‘2006-03-28‘, ‘BUY‘, ‘IBM‘, 1000, 45.00), (‘2006-04-05‘, ‘BUY‘, ‘MSFT‘, 1000, 72.00), (‘2006-04-06‘, ‘SELL‘, ‘IBM‘, 500, 53.00), ] c.executemany(‘INSERT INTO stocks VALUES (?,?,?,?,?)‘, purchases)
__conform__
adapter
detect_type
标签:style blog http io color os ar 使用 for
原文地址:http://www.cnblogs.com/phenixyu/p/4063752.html