Answers for "python read ifle"

41

python read file

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

python write to file

with open("testfile.txt", "w") as f:
  # "w" - write into file
  # "r" - read into file
  # "+" - read and write into file
  f.write("Hello World")
Posted by: Guest on January-09-2021

Python Answers by Framework

Browse Popular Code Answers by Language