Answers for "python read all contents in text file"

2

how to get the contents of a txt file in python

path= #path here
with open(path) as file
	contents = file.read()
Posted by: Guest on March-21-2021
0

read all text file python

# Open a file: file
file = open('my_text_file',mode='r')
 
# read all lines at once
all_of_it = file.read()
 
# close the file
file.close()
Posted by: Guest on September-04-2021

Code answers related to "python read all contents in text file"

Python Answers by Framework

Browse Popular Code Answers by Language