CSV ↔ JSON
把 CSV、TSV 或分号分隔的数据转换为 JSON,也能反向转换,处理带引号的字段、表头控制和文件下载。
完全在浏览器中运行 — 粘贴的内容不会被上传。
[
{
"id": "1",
"customer": "Ryu, Min",
"email": "ryu@example.com",
"total": "49.90",
"currency": "USD"
},
{
"id": "2",
"customer": "Ada \"the countess\" Lovelace",
"email": "ada@example.com",
"total": "120.00",
"currency": "GBP"
},
{
"id": "3",
"customer": "Grace Hopper",
"email": "grace@example.com",
"total": "15.50",
"currency": "USD"
}
]遵循 RFC 4180:带引号的分隔符、双写的引号和字段内换行都能保留。
CSV 与 JSON 参考
快速参考- "带引号, 的字段"
- 包含分隔符、引号或换行的字段必须用双引号包裹。
- 字段内的 ""
- RFC 4180 中唯一的转义方式:Ada ""the countess"" Lovelace 会被读回为 Ada "the countess" Lovelace。
- 分隔符
- 默认是逗号,但在把逗号当小数点的地区,制表符(TSV)或分号更常见。
- 表头行
- 有表头时每行会变成以列名为键的对象;没有表头时每行保持数组。
- CRLF 与 LF
- RFC 4180 使用 CRLF,但多数解析器也接受单独的 LF。Excel 导出 CRLF 并带末尾换行。
- Excel CSV
- 若列未预先设为文本格式,Excel 会去掉前导零并改写长数字;需要控制时用“数据 → 从文本导入”。
Python 相关语法指南
全部 Python 指南Python iter(): How the Built-in Function Works
Explains Python's iter() built-in: how it creates iterators, the two-argument sentinel form, custom iterator classes, and common edge cases.
PythonPython Pika: Queues, Exchanges, Routing Keys, and Acknowledgements
Learn how to use Python's Pika client with RabbitMQ: declare queues and exchanges, publish with routing keys, consume messages, and handle acknowledgements reliably.
PythonPython Kafka: kafka-python vs Confluent Client
python kafka python vs confluent kafka: Compare kafka-python and Confluent Kafka Python clients: API differences, performance, feature coverage, and when to choose eac...
PythonPython Kafka Offsets, Partitions, and Manual Commits
Learn how Kafka offsets and partitions work and how to manually commit offsets in Python consumers with kafka-python and confluent-kafka. Covers sync vs async commits, rebalances, and seeking.