xxxxxxxxxx
f = open("file.txt", 'r')
print(f.readlines()) # array of file lines
xxxxxxxxxx
# Open a file for reading
with open('myfile.txt', 'r') as file:
# Use .readlines() to read all lines into a list
lines = file.readlines()
# Now, 'lines' is a list where each element is a line from the file
# You can iterate through the list or access individual lines like this:
for line in lines:
print(line)