逗号分隔值.csv格式的一个字段的多个值 [英] Multiple values for one field in comma-separated values .csv format
问题描述
.csv文件的同一字段下是否可以有多个值?
Is it possible to have multiple values under the same field in a .csv file?
我的网页上有一个电子邮件"字段,用户可以选择输入多个地址.我希望我的.csv文件能够处理任意数量的电子邮件"值.我怎样才能做到这一点? .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文件的一个文件中可以有多个值.
Yes. You can have multiple values in one filed of a CSV file.
如果多个值之间用空格隔开,则不需要做任何特殊的操作,但是如果这些值之间用逗号隔开,则需要将整个字段用双引号引起来.
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.
示例:
Name,E-mail
foo,foo@a.com foo foo@b.com
bar,"bar@a.com,bar@b.com"
这篇关于逗号分隔值.csv格式的一个字段的多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!