CSV records are not physical lines — reproducible teaching examples Gumi article dated 2026-10-16. RUN Requires Python 3.9+ and standard library only. Recorded run used CPython 3.12.14, macOS 27.0.1 / Darwin, arm64, on 2026-10-16. python3 csv-record-boundaries.py csv-record-output Writes csv-record-output/sample.csv and results.json. To try the article's read/write excerpts, run them from inside csv-record-output. Re-running changes the report's timestamp and environment fields. ZIP MEMBERS - csv-record-boundaries.py - csv-record-boundaries-README.txt - csv-record-boundaries/sample.csv - csv-record-boundaries/results.json The raw sample.csv is carried inside the ZIP to preserve all CR/LF bytes. The report's baseline.sample_text also contains the complete decoded input. The two-dimensional parsed rows, naive split rows, boundary inputs, errors, and application-contract issues are recorded, not just a pass/fail label. 中文说明 所有输入均为合成教学数据,不是个人信息或生产导出。 格式明确为 UTF-8、逗号分隔、双引号引用、doublequote=True、 QUOTE_MINIMAL、skipinitialspace=False;reader 使用 strict=True。 writer 的记录分隔为 CRLF;字段内另含 CRLF、独立 CR 与 LF。 基础样例共 6 条记录(1 条表头与 5 条数据),每条 3 个字段。 正确解析的字符串单元格等于输入;相同 writer 设置重写后字节一致。 简单 splitlines() 再 split(',') 得到 9 行,字段数为: 3, 4, 3, 1, 3, 3, 1, 1, 3。 正确解析每条结束时的源行号为 1, 2, 4, 5, 8, 9。 默认 newline=None 读取仍得 6 条记录,但有 2 个字段的换行内容改变。 表头/列数检查只要求精确表头 id,name,note 与后续每条 3 列。 它不是完整 CSV 语法、字段类型或业务语义的验证器。 日本語説明 入力は合成の教材データで、個人情報や本番のエクスポートではありません。 UTF-8、カンマ、二重引用符、doublequote=True、QUOTE_MINIMAL、 skipinitialspace=Falseを明示し、readerはstrict=Trueです。 writerのレコード区切りはCRLFで、フィールドにCRLF、独立したCRとLFを含めます。 基本例は6レコード(ヘッダー1、データ5)、各3フィールドです。 解析した文字列セルは入力と一致し、同じwriter設定での書き戻しはバイトも一致。 splitlines()とsplit(',')では9行となり、フィールド数は 3, 4, 3, 1, 3, 3, 1, 1, 3でした。 各レコードを読み終えた元の行番号は1, 2, 4, 5, 8, 9です。 デフォルトのnewline=Noneでも6レコードですが、2セルの改行が変化しました。 ヘッダー・列数確認は正確なid,name,noteと後続の3列だけを要求し、 完全なCSV文法、フィールド型、業務の意味の検証ではありません。 BOUNDARIES IN RECORDED RUN - Unterminated quoted field: csv.Error, unexpected end of data. - Extra character after closing quote: csv.Error. - Short (2 fields) and long (4 fields) records: parser accepts; contract rejects. - Duplicate header id,id,note: parser accepts; contract rejects. - bare"quote in an unquoted field: parser accepts, contract accepts. This demonstrates that these checks are not an RFC-conformance suite. - Empty file: parser returns zero records; contract rejects the missing header. - Writing ['', None] under this QUOTE_MINIMAL configuration yields comma, CRLF; reading produces ['', '']. The original distinction is lost. SCOPE Observed results are for the recorded Python version and stated settings. No Excel/Numbers/database integration, other encodings/BOM handling, dialect sniffing, full RFC validation, all type/semantic checks, or performance tests. No claim that every CSV file rewrites to identical bytes or that every CSV representation must lose the distinction between missing and empty values. PRIMARY REFERENCES (checked 2026-10-16) https://www.rfc-editor.org/rfc/rfc4180.html https://www.rfc-editor.org/rfc/rfc7111.html#section-5.1 https://docs.python.org/3.12/library/csv.html https://docs.python.org/3.12/library/io.html#io.TextIOWrapper RFC 4180 is Informational. The UTF-8 examples use stated Python settings, not a claim to validate every rule in the original RFC grammar. Official documentation facts, observations from these runs, and application advice are identified separately in the article.