1 parent 75451ec commit dc66810Copy full SHA for dc66810
1 file changed
src/codeaudit/totals.py
@@ -95,10 +95,11 @@ def count_lines_iterate(filepath):
95
"""
96
Counts the number of lines in a file by iterating through the file object.
97
This method is memory-efficient for large files.
98
+ filepath is a Python file, so a text file
99
100
count = 0
101
try:
- with open(filepath, "r") as f:
102
+ with open(filepath, "r", encoding="utf-8") as f:
103
for line in f:
104
count += 1
105
return count
0 commit comments