以逗号分隔的值.csv格式的一个字段的多个值

时间:2023-01-11 19:19:45

Is it possible to have multiple values under the same field in a .csv file?

是否可以在.csv文件中的同一字段下有多个值?

I have an "email" field on my webpage, and the user may optionally type in multiple addresses. I want my .csv file to be able to handle an arbitrary number of "email" values. How can I achieve this? The .csv is read by a third party program which I cannot modify.

我的网页上有一个“电子邮件”字段,用户可以选择输入多个地址。我希望我的.csv文件能够处理任意数量的“电子邮件”值。我怎样才能做到这一点? .csv由第三方程序读取,我无法修改。

1 个解决方案

#1


22  

Yes. You can have multiple values in one filed of a CSV file.

是。您可以在CSV文件的一个字段中包含多个值。

If the multiple values are separated by space you need not do anything special but if the values are separated by a comma, you need to enclose the entire field in double quotes.

如果多个值由空格分隔,则无需执行任何特殊操作,但如果值以逗号分隔,则需要将整个字段用双引号括起来。

Example:

例:

Name,E-mail    
foo,foo@a.com foo foo@b.com
bar,"bar@a.com,bar@b.com"

#1


22  

Yes. You can have multiple values in one filed of a CSV file.

是。您可以在CSV文件的一个字段中包含多个值。

If the multiple values are separated by space you need not do anything special but if the values are separated by a comma, you need to enclose the entire field in double quotes.

如果多个值由空格分隔,则无需执行任何特殊操作,但如果值以逗号分隔,则需要将整个字段用双引号括起来。

Example:

例:

Name,E-mail    
foo,foo@a.com foo foo@b.com
bar,"bar@a.com,bar@b.com"