How is it that opening a file in write mode and immediatly closing it will delete the files content? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

How is it that opening a file in write mode and immediatly closing it will delete the files content?

Open "filename", write

13th Feb 2019, 5:24 AM
Templeton Meshack
Templeton Meshack - avatar
2 Réponses
+ 3
write means actually, overwrite. If you want to make sure the original content is kept, use append mode
13th Feb 2019, 6:05 AM
Tibor Santa
Tibor Santa - avatar
+ 2
The file contents are deleted
14th Mar 2020, 4:02 AM
Moise DIARRA
Moise DIARRA - avatar