import pathlib
file_path = 'vocab.txt'
vocab = pathlib.Path(file_path).read_text().splitlines()
print(len(vocab))
count = 0
with open(file_path, 'r', encoding='utf8') as f:
for line in f:
count += 1
print(count)
The two counts are 2122 and 2120. Shouldn't they be same?