Answers for "read text file in python as single string"

0

read text file in python as single string

#open text file in read mode
text_file = open("D:/data.txt", "r")
 
#read whole file to a string
data = text_file.read()
 
#close file
text_file.close()
 
print(data)
Posted by: Guest on October-25-2021

Code answers related to "read text file in python as single string"

Python Answers by Framework

Browse Popular Code Answers by Language