f = open('filename.txt', 'r')
print(f.read())
f.close()
Open function is used to open the file. The first parameter is the file to open and the second parameter (r) opens the file in read-only mode.
Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.