Ich bin neu bei Python und ich schreibe diesen Code unten.AttributeError: 'bool' Objekt hat kein Attribut 'count'
fileName = input("Enter the file name: ")
InputFile = open(fileName, 'r')
text=InputFile.readable()
sentences = text.count('.') + text.count('?') + \
text.count(':') + text.count(';') + \
text.count('!')
Ich kann die Zählfunktion wegen dieses Fehlers unten nicht erreichen. Ich habe etwas recherchiert und versucht, einige Bibliotheken zu importieren, aber das hat nicht funktioniert. Kann mich jemand in die richtige Richtung führen? Ich fühle mich so verloren.
text.count(':') + text.count(';') + \
AttributeError: 'bool' object has no attribute 'count'
Was denken Sie 'text = InputFile.readable()' macht? – jwodder