Drop links or images here to add them to the editor.

Met modus "a" voeg je tekst toe aan het einde van een bestand (zonder de bestaande inhoud te overschrijven):

bestand = open("uitvoer.txt", "a")
bestand.write("Nieuwe regel\n")
bestand.close()

Vergelijking:

Modus Bestand bestaat al Bestand bestaat niet
"w" Inhoud wordt overschreven Nieuw bestand
"a" Tekst wordt toegevoegd Nieuw bestand