From 13b5100d7ccea9caf386e45ad259a0b72cd618ed Mon Sep 17 00:00:00 2001 From: Fang Ting <158748159+cccccccftzz@users.noreply.github.com> Date: Sun, 25 Feb 2024 00:25:56 +0800 Subject: [PATCH] Update 19_file_handling.md --- 19_Day_File_handling/19_file_handling.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/19_Day_File_handling/19_file_handling.md b/19_Day_File_handling/19_file_handling.md index de51b9b..727d590 100644 --- a/19_Day_File_handling/19_file_handling.md +++ b/19_Day_File_handling/19_file_handling.md @@ -166,7 +166,7 @@ with open('./files/reading_file_example.txt') as f: To write to an existing file, we must add a mode as parameter to the _open()_ function: -- "a" - append - will append to the end of the file, if the file does not it creates a new file. +- "a" - append - will append to the end of the file, if the file does not exist it creates a new file. - "w" - write - will overwrite any existing content, if the file does not exist it creates. Let us append some text to the file we have been reading: @@ -349,6 +349,7 @@ with open('./files/csv_example.csv') as f: ```sh # output: Column names are :name, country, city, skills +Number of lines: 1 Asabeneh is a teacher. He lives in Finland, Helsinki. Number of lines: 2 ```