I am attempting to index specific characters to their own variable, and I am only able to do this for 1 character.
with open(fileName) as f:
count1 = sum(l[0] == '1' for l in f)
count2 = sum(l[0] == '2' for l in f)
print(count1)
print(count2)
This is my output
5 0
According to the values in the csv file, it should be:
5 4
I should mention, when I change the value from '1' to '2' in the first variable, it does give me 4, for some reason I cannot do both though.