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

Je schrijft naar een bestand met modus "w":

bestand = open("uitvoer.txt", "w")
bestand.write("Hallo wereld!")
bestand.close()

Let op:

Een lijst schrijven met writelines():

bestand = open("kleuren.txt", "w")
bestand.writelines(["rood\n", "wit\n", "blauw\n"])
bestand.close()