7 lines
188 B
Python
7 lines
188 B
Python
def countstring(character, filepath):
|
|
myfile = open(filepath)
|
|
content = myfile.read()
|
|
myfile.close()
|
|
return(content.count(character))
|
|
|
|
print(countstring("a", "fruits.txt")) |