def get_num_features(filename): counting = False count = 0 for line in open(filename): if counting: count += 1 else: if line.strip() == ':0': counting = True return count