8000 Update 7-challenge-create-a-high-scores-list.py · lgrando1/python-basics-exercises@9d61225 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9d61225

Browse files
authored
Update 7-challenge-create-a-high-scores-list.py
Add missing writeheader call. Thanks to Bobby Cottrell for reporting this.
1 parent fb0ec9b commit 9d61225

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ch12-file-input-and-output/7-challenge-create-a-high-scores-list.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
output_csv_file = Path.home() / "high_scores.csv"
3939
with output_csv_file.open(mode="w", encoding="utf-8") as file:
4040
writer = csv.DictWriter(file, fieldnames=["name", "high_score"])
41+
writer.writeheader()
4142
for name in high_scores:
4243
row_dict = {"name": name, "high_score": high_scores[name]}
4344
writer.writerow(row_dict)

0 commit comments

Comments
 (0)
0