Commit 7ecc7c4
Sample code for: Python 3.15 Preview: UTF-8 by Default (#797)
* Sample code for: Python 3.15 Preview: UTF-8 by Default
* Rename example files descriptively and print entry count in app_v2
* Add data files read by the sample scripts
Ship data.json, legacy.csv, and notes.txt so every script runs on first
try instead of raising FileNotFoundError. Also align the os_encoding.py
comment with the tutorial's lowercase "UTF-8 mode".
* Keep app.py parsing JSON after adding the explicit encoding
app_v2.py read the file as raw text, so len(data) counted characters and
printed "Loaded 29 entries". Restore json.load() so the only difference
from app_v1.py is the encoding argument, matching the tutorial.
* Parse data.json with json.load() in explicit_encoding.py
Keeps data.json handling consistent with app_v1.py and app_v2.py across
the tutorial's examples. legacy.csv stays a raw read, since the point
there is the locale sentinel rather than parsing.
---------
Co-authored-by: Bartosz Zaczyński <bartosz.zaczynski@gmail.com>1 parent b474a7c commit 7ecc7c4
12 files changed
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments