我有一个包含大约2000条记录的CSV文件.
每条记录都有一个字符串和一个类别.
This is the first line, Line1
This is the second line, Line2
This is the third line, Line3
Run Code Online (Sandbox Code Playgroud)
我需要将此文件读入一个看起来像这样的列表;
List = [('This is the first line', 'Line1'),
('This is the second line', 'Line2'),
('This is the third line', 'Line3')]
Run Code Online (Sandbox Code Playgroud)
如何将此导入csv到我需要使用Python的列表中?
我有一个CSV文件,我想使用Python将此文件批量导入我的sqlite3数据库.命令是".import .....".但它似乎无法像这样工作.谁能给我一个如何在sqlite3中做到这一点的例子?我正在使用Windows以防万一.谢谢