How can I fix AttributeError: 'str' object has no attribute 'read' error in my python3 script.
user = input("Enter your word : ")
script = open('wordlist.txt', "r")
for s in script:
content = s.read()
if user in content:
print("Match")
else:
print("Not match")
content = script.read()and lose the for loopread()is a files' method but you call it onswhich is a string representing each row of the file. Either change toif user in sin the loop or simplyif user in script.read()