Answers for "Read files from Python"

41

python read file

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

python append a file and read

f = open(filelocation/name, "a")
f.write("Now the file has more content!")
f.close()

#open and read the file after the appending:
f = open("C:/test/input.txt", "r")
print(f.read())
Posted by: Guest on July-24-2020

Code answers related to "Read files from Python"

Python Answers by Framework

Browse Popular Code Answers by Language