Tambahkan baris ke file teks menggunakan fungsi tulis ()
# Program to append to text file using write() function
with open("python.txt", "a") as file:
content = "Append the content at the end \n"
file.write(content)
file.close()
# Program to read the entire file (absolute path) using read() function
with open("C:/Projects/Tryouts/python.txt", "r") as file:
content = file.read()
print(content)
file.close()
Gorgeous Gazelle