Answers for "python print file contents"

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
Posted by: Guest on August-05-2020
1

python print contents of file

f = open("file_name.txt", "r")
print(f.read())
f.close()
Posted by: Guest on May-08-2021

Code answers related to "python print file contents"

Python Answers by Framework

Browse Popular Code Answers by Language