Python Menulis ke file teks dengan baris baru
# This will open a new file called myFile.txt and
# write 0 - 4 using a loop, each on a new line.
# Note the "\n" part!
with open("myFile.txt", "w") as file:
for i in range(0,5):
file.write(str(i) + "\n")
# We do not need to use "file.close()" because
# we used "with open(...)" which is considered
# to be more "pythonic"
CoderHomie