Answers for "access and read files in python"

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

Code answers related to "access and read files in python"

Python Answers by Framework

Browse Popular Code Answers by Language