File size: 641 Bytes
a844e29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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.")