0 points

How to read entire text file in Python?


dashboard

Wed May 27 2020 17:25:40 GMT+0000 (UTC)

Posted by @hamzaafridi #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()
content_copy Copy

https://cmdlinetips.com/2018/01/how-to-read-entire-text-file-in-python/