The goal for my project is to count all the characters in a text file. My code seems to work, but seems it will only ready the first line of code from the file and nothing else. I can easily do it in java, but we are required to use python and I have very little experience working with python
my code is as follows:
import pandas as pd
from collections import Counter
with open ('myFile', "r") as myfile:
data=myfile.readlines()
counter = Counter(lines)
print (counter['a'])
print (counter['b'])
print (counter['c'])
print (counter['d'])
print (counter['e'])
print (counter['f'])
print (counter['g'])
print (counter['h'])
print (counter['i'])
print (counter['j'])
print (counter['k'])
print (counter['l'])
print (counter['m'])
print (counter['n'])
print (counter['o'])
print (counter['p'])
print (counter['q'])
print (counter['r'])
print (counter['s'])
print (counter['t'])
print (counter['u'])
print (counter['v'])
print (counter['w'])
print (counter['x'])
print (counter['y'])
print (counter['z'])