Python Read and Write File

In this tutorial, you’ll learn how to read and write file in Python. Program to Write to File f = open(“newtext.txt”,”w”) f.write(“something to be write”) f.close() Output: this program will create a new file (if not exist) named as “newtext.txt” in the same directory where our program is located and write a line “something to …

Python Read and Write File Read More »