summaryrefslogtreecommitdiff
path: root/Reading a file line-by-line in Python is easy with a for loop.md
blob: d011e91dee9bfc2a655e427a3262dcb87efb0615 (plain)
1
2
3
4
5
6
7
8
9
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)
```