Answers for "read file pthon"

41

python read file

with open("file.txt", "r") as txt_file:
  return txt_file.readlines()
Posted by: Guest on November-30-2020
0

how to read files in python

f = open("demofile.txt", "r")
print(f.read()) 
f.close()

#OR

with open("demofile.txt","r") as file:
  print(file.read())
Posted by: Guest on May-16-2021

Python Answers by Framework

Browse Popular Code Answers by Language