Count number of lines in a AVRO file using python

Viewed 2448

So currently i am able to open the avro file using:

import avro.schema
from avro.datafile import DataFileReader, DataFileWriter
from avro.io import DatumReader, DatumWriter

reader = DataFileReader(open("myfile.avro", "r"), DatumReader())
for user in reader:
  print (user)
reader.close()

After this process, I would like to be able to count the number of lines in this file using python code. I am currently using Python 2.7 through Spyder.

Any help is appreciated.

1 Answers
Related