I'm trying to get python to count how many of a letter or symbol that there is in a text file. My text file is '*#%##'
but for some reason when I input a symbol it counts all of the characters rather than the input so I get an output of 5 rather than 3 if I for example inputted '#'
.
This what I have done so far:
Symbol = input("Pick a Symbol ")
freq = 0
with open ("words.txt", "r") as myfile:
data = myfile.read().replace('\n', '')
print(data)
for Symbol in data:
freq = (freq + 1)
print(freq)