Tonic commited on
Commit
a844e29
1 Parent(s): 11ccc76

initial commit

Browse files
Files changed (1) hide show
  1. countrows.py +17 -0
countrows.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def count_rows(file_path):
2
+ count = 0
3
+ try:
4
+ with open(file_path, 'r', encoding='utf-8', errors='ignore') as file:
5
+ for line in file:
6
+ count += 1
7
+ if count % 100000 == 0:
8
+ print(f"Processed {count} lines so far...")
9
+ except FileNotFoundError:
10
+ print("File not found.")
11
+ except IOError:
12
+ print("Error reading file.")
13
+ return count
14
+
15
+ file_path = r"C:\Users\MeMyself\reddit_question_best_answers\processed\synthesized_dataset.jsonl" # Replace with your file path
16
+ number_of_rows = count_rows(file_path)
17
+ print(f"The file has {number_of_rows} lines.")