반응형
- CSV 저장하기
import csv
rows = [["Name", "Age", "City"],
["John", 30, "New York"],
["Jane", 25, "London"],
["Jim", 35, "Paris"]]
with open("people.csv", "w", newline="") as file:
writer = csv.writer(file)
writer.writerows(rows)
- CSV 불러오기
import csv
with open("people.csv", "r") as file:
reader = csv.reader(file)
for row in reader:
print(row)
반응형