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

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

showing results for - "write a line to a text file using the write 28 29 function"
Marvin
01 Oct 2019
1# Program to write to text file using write() function
2with  open("python.txt", "w") as file:
3	content = "Hello, Welcome to Python Tutorial !! \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()