read and write file is ok, but does write command also creates the file if not present? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 1

read and write file is ok, but does write command also creates the file if not present?

i am in the middle of read and write file portion, question came up to my mind ?

21st Jan 2017, 4:53 AM
mrityunjay nath
mrityunjay nath - avatar
2 ответов
+ 3
but keep in mind if you want to add something to a file using file mode 'a' In this case the file must exist.
18th Feb 2017, 12:10 AM
Marco
Marco - avatar
+ 2
open in mode 'w' uses the file if it is present and creates it if it is not.
22nd Jan 2017, 1:46 AM
Amaras A
Amaras A - avatar