summaryrefslogtreecommitdiff
path: root/Reading a file line-by-line in Python is easy with a for loop.md
diff options
context:
space:
mode:
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)
+```