CSV(逗号分隔值)
CSV 是最简单的表格数据格式 — 以逗号(或其他分隔符)分隔的值行。它受到电子表格、数据库和编程语言的普遍支持,是数据交换和导入导出工作流程的通用语言。
MIME 类型
text/csv
类型
文本
压缩
无损
优点
- + Universal support in Excel, Google Sheets, databases, and every language
- + Human-readable and easy to generate
- + Minimal overhead — just data, no formatting or metadata
- + Streamable — can be processed line by line for large files
缺点
- − No data type information — numbers, dates, and strings all look the same
- − Encoding and delimiter ambiguity (comma vs semicolon vs tab)
- − No support for hierarchical or nested data
何时使用 .CSV
在简单的数据导出/导入、电子表格数据交换以及向脚本和管道提供数据时使用 CSV。
技术细节
CSV 文件是纯文本,每行一条记录,值由逗号分隔。带引号的字段(双引号)可包含逗号、换行符和转义引号。数据类型没有标准 — 一切都是字符串。
历史
逗号分隔数据格式早于个人电脑的出现,在 1970 年代初的 IBM Fortran 中就已使用。RFC 4180(2005)正式规范了 CSV 格式,但仍存在许多变体。
从 .CSV 转换
转换为 .CSV
相关格式
相关术语
Learn More
File Format Conversion: A Complete Guide
Converting files between formats is a daily task for professionals across every industry. This comprehensive guide covers document, image, audio, …
How to Generate Strong Random Passwords
Password generation requires cryptographic randomness and careful character selection. This guide covers the principles behind strong password generation, entropy calculation, …
JSON vs YAML vs TOML: Choosing a Configuration Format
Configuration files are the backbone of modern applications. JSON, YAML, and TOML each offer different trade-offs between readability, complexity, and …
Text Encoding Explained: UTF-8, ASCII, and Beyond
Text encoding determines how characters are stored as bytes. Understanding UTF-8, ASCII, and other encodings prevents garbled text, mojibake, and …
CSV vs JSON vs XML: Data Exchange Formats Compared
Data exchange formats serve different needs. CSV excels at tabular data, JSON dominates web APIs, and XML powers enterprise integrations. …
How to Format and Validate JSON Data
Malformed JSON causes silent failures in APIs and configuration files. Learn how to format, validate, and debug JSON documents to …