-4
DEF countLetters(计数):我不知道这个Python代码有什么问题,但它说“预计一个缩进块”?
letterList = []
在计数字母: 如果信不在letterList: letterList.append(字母)
返回letterList
词语= open(“/ Users/Sammi/Desktop/Hw3_nanisama/words.txt”,“r”)
print(words)
打印( “文件长度:”,LEN(字))
打印( “一”,LEN(aCount))
打印( “B:”,LEN(bCount))
的emptyList =名单()
读一本Python书... –
[Python期望的缩进块错误]的可能重复(http://stackoverflow.com/questions/12632615/python-expected-an-indented-block-error) – miradulo
Python是[偏移规则](https: //en.wikipedia.org/wiki/Off-side_rule)语言,从而定义带有缩进的代码块。这段代码没有正确缩进。 –