Firstly we need to create a text file as mytextfile.txt
Then write into it as… Hey, here is the content of the file
Then create another file as let’s read.py python file and open it with IDLE
Then write the code into it as
f=open(“mytextfile.txt”, “r”)
t=f.read()
print(t)
f.close()
In this, the text file content will be displayed or read as we opened the file in read mode then with the help of close function the file is closed