python - AttributeError: 'bool' object has no attribute 'count' -
i new python , writing code below.
filename = input("enter file name: ") inputfile = open(filename, 'r') text=inputfile.readable() sentences = text.count('.') + text.count('?') + \ text.count(':') + text.count(';') + \ text.count('!')
i can't past count function because of error below. have done research , tried importing libraries didn't work. can guide me in right direction? feel lost.
text.count(':') + text.count(';') + \ attributeerror: 'bool' object has no attribute 'count'
there buggy line in code:
text = inputfile.readable()
which returns boolean
has no attribute count
should have been:
text = inputfile.read()
Comments
Post a Comment