diff --git a/.zk/notebook.db b/.zk/notebook.db index aba1f2f..26be13d 100644 Binary files a/.zk/notebook.db and b/.zk/notebook.db differ diff --git a/zk/Working_with_CSVs_in_Python.md b/zk/Working_with_CSVs_in_Python.md index 23f8363..4e56c0a 100644 --- a/zk/Working_with_CSVs_in_Python.md +++ b/zk/Working_with_CSVs_in_Python.md @@ -2,11 +2,35 @@ id: sgtn title: Working_with_CSVs_in_Python tags: [] -created: Sunday, April 28, 2024 +created: Sunday, April 28, 2024 --- + # Working_with_CSVs_in_Python +## Core package -## Related notes +```py +import csv +``` +## Read and write to CSV +### Read + +Use standard Pythonic "read" syntax: + +```py +with open('./path.csv', mode="r") as csv_file: + reader = csv.reader(csv_file) +``` + +### Write + +Use standard Pythonic "read" syntax: + +```py +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.