554 B
554 B
id | title | tags | created |
---|---|---|---|
sgtn | Working_with_CSVs_in_Python | Sunday, April 28, 2024 |
Working_with_CSVs_in_Python
Core package
import csv
Read and write to CSV
Read
Use standard Pythonic "read" syntax:
with open('./path.csv', mode="r") as csv_file:
reader = csv.reader(csv_file)
Write
Use standard Pythonic "read" syntax:
with open('./new_csv_file.csv', mode="w") as csv_file:
write = csv.writer(csv_file)
The above will create the file as well, it doesn't need to be pre-existing.