append a line to a text file using the write 28 29 function

Solutions on MaxInterview for append a line to a text file using the write 28 29 function by the best coders in the world

showing results for - "append a line to a text file using the write 28 29 function"
Claudia
15 Aug 2020
1# Program to append to text file using write() function
2with  open("python.txt", "a") as file:
3	content = "Append the content at the end \n"
4	file.write(content)
5	file.close()
6
7
8# Program to read the entire file (absolute path) using read() function
9with open("C:/Projects/Tryouts/python.txt", "r") as file:
10	content = file.read()
11	print(content)
12	file.close()
similar questions