Can a CSV file have a comment?

前端 未结 7 1388
悲&欢浪女
悲&欢浪女 2020-12-02 16:29

Is there any official way to allow a CSV formatted file to allow comments, either on its own line OR at the end of a line?

I tried checking wikipedia on this and als

7条回答
  •  被撕碎了的回忆
    2020-12-02 16:37

    I think the best way to add comments to a CSV file would be to add a "Comments" field or record right into the data.

    Most CSV-parsing applications that I've used implement both field-mapping and record-choosing. So, to comment on the properties of a field, add a record just for field descriptions. To comment on a record, add a field at the end of it (well, all records, really) just for comments.

    These are the only two reasons I can think of to comment a CSV file. But the only problem I can foresee would be programs that refuse to accept the file at all if any single record doesn't pass some validation rules. In that case, you'd have trouble writing a string-type field description record for any numeric fields.

    I am by no means an expert, though, so feel free to point out any mistakes in my theory.

提交回复
热议问题