summaryrefslogtreecommitdiff
path: root/Reading a file line-by-line in Python is easy with a for loop.md
diff options
context:
space:
mode:
authorJasper Ras <jras@hostnet.nl>2025-04-30 15:14:56 +0200
committerJasper Ras <jras@hostnet.nl>2025-04-30 15:14:56 +0200
commit4223e9afd4401bd930ca815ffa816eb76fad83f6 (patch)
treeb8907fc631e2ad61b7c8741304b8cd6e6e4a53de /Reading a file line-by-line in Python is easy with a for loop.md
parentf43d0473320b9b2297b1a00880316aee9066b81a (diff)
vault backup: 2025-04-30 15:14:56
Diffstat (limited to 'Reading a file line-by-line in Python is easy with a for loop.md')
-rw-r--r--Reading a file line-by-line in Python is easy with a for loop.md10
1 files changed, 10 insertions, 0 deletions
diff --git a/Reading a file line-by-line in Python is easy with a for loop.md b/Reading a file line-by-line in Python is easy with a for loop.md
new file mode 100644
index 0000000..d011e91
--- /dev/null
+++ b/Reading a file line-by-line in Python is easy with a for loop.md
@@ -0,0 +1,10 @@
+---
+tags:
+ - python
+---
+An easy and efficient way to read a file line-by-line is by simple using the file object as the iterable.
+
+```
+for line in file:
+ print(line)
+```