Code Lab BetaBUILD. RUN. DISCOVER.
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
Loading…
Code Lab is in development. New lessons and improvements are on the way. Progress can be deleted.
PYTHON FILES / CHAPTER 05 / Learn / LESSON 08
Writing CSV:
import csv rows = [["name", "qty"], ["tea", "2"], ["mug", "1"]] with open("out.csv", "w", encoding="utf-8", newline="") as f: writer = csv.writer(f) writer.writerows(rows)
Verify by reading the file back or printing its content. writer.writerow for one row, writerows for a list.
Learn: writer + verify.
DATA LAUNCH STANDBY
›