如何阻止逗号分成CSV中的新单元格

时间:2017-10-22 21:43:20

标签: csv

您好我有一个HTML抓取器,它从网站上抓取信息并生成一个csv文件,然后我使用我编写的程序将HTML转换为csv格式。我需要其中一个单元格来保持其语法而不进入一个新的单元格,这里是一个我需要一个单元格来维护而不会破坏新单元格的示例

[{ “ID”: “1”, “值”:“https://images-eu.ssl-images-amazon.com/images/I/41-GLGUPXnL SL160 .jpg“},{”id“:”2“,”value“:[”立即购买“,”https://www.amazon.co.uk/Wileyfox-Swift-Plus-Smartphone-Replacement-Midnight-Blue / DP / B01M8NAVEP PSC = 1&安培; SubscriptionId = AKIAJ76EIXAV3V6D6JEQ&安培;标记= gnod-21&安培; linkCode = XM2&安培;营= 2025&安培;创造性= 165953&安培; creativeASIN = B01M8NAVEP”, “新”]},{ “ID?”: “3” ,“价值”:“Wileyfox Swift 2 Plus - 带屏幕更换卡和硬壳的32GB + 3GB 4G SIM卡 - 智能手机 - 午夜”},{“id”:“4”,“value”:“189.99”},{ “id”:“5”,“value”:“截至2017年10月18日,08:34”},{“id”:“6”,“value”:“5”},{“id”:“ 7“,”value“:”720 x 1280“},{”id“:”8“,”value“:”32“},{”id“:”9“,”value“:”3“}, { “ID”: “10”, “值”: “8”},{ “ID”: “11”, “值”: “155”},{ “ID”: “12”, “值”:[ “2”]},{“id”:“13”,“value”:[“SD Card”]},{“id”:“14”,“value”:“2700”},{“id”: “15”, “值”: “3”},{ “ID”: “16”, “值”: “机器人”},{ “ID”: “17”, “值”: “45”}] < / p>

你可以理解,这是分裂成多个单元,有助于我如何避免这种分离,谢谢。

1 个答案:

答案 0 :(得分:0)

所以,如果想出来的话,那真的很简单。我刚刚在JSON数据周围添加了",",如下例所示,它阻止了单元格的拆分。 ","[{"id":"1","value":"https://images-eu.ssl-images-amazon.com/images/I/41-GLGUPXnL.SL160.jpg"},{"id":"2","value":["Buy Now","https://www.amazon.co.uk/Wileyfox-Swift-Plus-Smartphone-Replacement-Midnight-Blue/dp/B01M8NAVEP?psc=1&SubscriptionId=AKIAJ76EIXAV3V6D6JEQ&tag=gnod-21&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01M8NAVEP","new"]},{"id":"3","value":"Wileyfox Swift 2 Plus - 32GB + 3GB 4G SIM-Free Smartphone with Screen Replacement Card and Hard Case - Midnight"},{"id":"4","value":"189.99"},{"id":"5","value":"as of Oct 18, 2017, 08:34"},{"id":"6","value":"5"},{"id":"7","value":"720 x 1280"},{"id":"8","value":"32"},{"id":"9","value":"3"},{"id":"10","value":"8"},{"id":"11","value":"155"},{"id":"12","value":["2"]},{"id":"13","value":["SD Card"]},{"id":"14","value":"2700"},{"id":"15","value":"3"},{"id":"16","value":"Android"},{"id":"17","value":"45"}]","我已经看过关于这个主题的其他帖子,其中有很多令人困惑的术语,对于新手来说从来没有帮助我解决我的问题,我希望这篇文章可以帮助我的位置上想要简单回答的其他人。< / p>