import bz2 import sys f = bz2.BZ2File(sys.argv[1]) c = 0 for l in f: c += 1 print(c)