使用Python将CSV文件导入sqlite3数据库表

我有一个CSV文件,我想使用Python将此文件批量导入到sqlite3数据库中。该命令是“ .import .....”。但似乎不能这样工作。谁能给我一个在sqlite3中做事的例子吗?我正在使用Windows,以防万一。谢谢

回答:

from bisect import bisect_left

def binary_search(a, x, lo=0, hi=None): # can't use a to specify default for hi

hi = hi if hi is not None else len(a) # hi defaults to len(a)

pos = bisect_left(a, x, lo, hi) # find insertion position

return pos if pos != hi and a[pos] == x else -1 # don't walk off the end

以上是 使用Python将CSV文件导入sqlite3数据库表 的全部内容, 来源链接: utcz.com/qa/431614.html

回到顶部