File read in python

Description

Python Program to read the contents of sample.txt file and display it.

Solution

file=open("sample.txt",'r')
print(file.read())
file.close()

Explanation

open the file in read mode
read all the contents of file using read() method
close() the file.