导入 csv 到 sqlite3 崩溃
我有一个以逗号分隔的 csv 文件。我对它的导入方面没有问题,除了当导入到达这样的行时:
1,2,3, Canada's,5, 6,7
当到达单引号时导入崩溃。有谁知道我可以使用一个程序将 csv 文件导入到 sqlite 数据库中,而不必删除所有单引号?
I have a csv file that is comma delimited. I have no problem with the importing aspect of it except for when the import reaches a line like this:
1,2,3, Canada's,5, 6,7
The import crashes when it reaches the single quote. Does anyone know of a program I could use to import my csv file in to sqlite database without having to get rid of all my single quotes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在命令行(即在终端中)尝试此操作:
这将创建一个新文件,其中所有单引号都用反斜杠转义,这应该允许您导入它。当然,这取决于您的导入程序是否识别反斜杠,但值得一试:-)
Try this on the command line (i.e. in Terminal):
That will create a new file with all the single quotes escaped with a backslash, which should allow you to import it. Of course, it depends on whether your importer recognizes backslashes, but it's worth a try :-)