open a file in python read code example
Example 1: python read file
with open("file.txt", "r") as txt_file:
return txt_file.readlines()
Example 2: how to read files in python
#Read files with loop
#Replace (File path) with your text file's path
file = open("(File path)", "r")
text = ""
for line in file:
text = "%s\n%s"%(text, line)
print(text)