EasyReddit / countrows.py
Tonic's picture
initial commit
a844e29
raw
history blame contribute delete
641 Bytes
def count_rows(file_path):
count = 0
try:
with open(file_path, 'r', encoding='utf-8', errors='ignore') as file:
for line in file:
count += 1
if count % 100000 == 0:
print(f"Processed {count} lines so far...")
except FileNotFoundError:
print("File not found.")
except IOError:
print("Error reading file.")
return count
file_path = r"C:\Users\MeMyself\reddit_question_best_answers\processed\synthesized_dataset.jsonl" # Replace with your file path
number_of_rows = count_rows(file_path)
print(f"The file has {number_of_rows} lines.")