python print file contents code example
Example 1: code for showing contents of a file and printing it in python
import os
with open("filename", "r+") as file:
content = file.readline()
while(content!=""):
print(content)
content = file.readline()
file.close
Example 2: python print contents of file
f = open("file_name.txt", "r")
print(f.read())
f.close()