Write a python function that Counts the Number of Times a Certain Letter Appears in the Text File
Topic: Write a python function that Counts the Number of Times a Certain Letter Appears in the Text File
Solution
def count_letter(fname, l): k = 0 with open(fname, 'r') as f: for line in f: words = line.split() for i in words: for letter in i: if(letter==l): k=k+1 return k
List all Python Programs