Answers for "read file function python"

47

python read file

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

open and read a file in python

my_file = open("C:\Users\Python\file.txt", "r")
#Give the path accurately and use \
text = my_file.read()
print(text)

#Output: The text in file.txt will be printed
Posted by: Guest on January-06-2022

Code answers related to "read file function python"

Python Answers by Framework

Browse Popular Code Answers by Language