輸入一個文件和一個字符,統計該字符在文件中出現的次數
***********************************************************************
def times(filename,char):
count=0
f=open(filename,'r',encoding='utf-8')
txt=f.read()
txt=txt.lower()
for word in txt:
if char==word:
count+=1
f.close()
return count
print(times('Summer.txt','w'))
**********************************************************************