f = open("file.txt", "r")
lines = f.readlines()
print(lines)
Tag: file
-
+
+
+
+
+
+
-
+
+
+
+
+
+
- from the directory, where the script is executed,
- the file called “filename.txt” is opened, just for reading purposes,
- all lines of the file are interpeted as objects in a list
- in a loop, every object of this list is printed to the main output.
f = open("filename.txt", "r") lines = f.readlines() for line in lines: print(line, end="")