且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在csv文件中用逗号分隔值?

更新时间:2023-01-31 18:29:25

CSV代表 C omma S eparated V alues - 这意味着逗号分隔两个值,因此1,56将被解释为两个值(两个单元格)......

正如它在CSV定义中所述:

引用:
6。包含换行符(CRLF),双引号和逗号

的字段应括在双引号中。例如:



aaa,b CRLF

bb,cccCRLF

zzz ,yyy,xxx



https://tools.ietf.org/html/rfc4180 [ ^ ]


Ex, 'x, y' in one cell. X and y will be different values for every row, that is why I cannot do "x, y" to write a comma.

What I have tried:

https://docs.python.org/3/library/csv.html

CSV stands for Comma Separated Values - it means that a comma separate two values, so 1,56 will be interpreted as two values (two cells)...
As it stated in CSV definition:
Quote:

6. Fields containing line breaks (CRLF), double quotes, and commas
should be enclosed in double-quotes. For example:

"aaa","b CRLF
bb","ccc" CRLF
zzz,yyy,xxx


https://tools.ietf.org/html/rfc4180[^]