У меня проблема с моим кодом и ошибка TypeError: строковые индексы должны быть целыми числами, а не str.Любая помощь или предложение?
мой код:
f= open("studentname.txt", 'r')
finChar = raw_input("please enter a character to count ")
a=finChar.lower()
b=finChar.upper()
c=a+b
str = ''
for line in f.readlines():
str = str + line
count = 0
for i in str:
if str[i]== c :
count = count + 1
f.close()
print "the total character in the file is ", count