🔢 Counting Lines in a File

PHOTO EMBED

Mon Oct 24 2022 05:39:30 GMT+0000 (Coordinated Universal Time)

Saved by @L0uJ1rky45M #python

handler = open('textfile.txt')
count = 0
for line in handler: #for loop reads each line
    count = count + 1
print('Line Count:', count)
content_copyCOPY

https://www.py4e.com/lessons/files#