如何修复AttributeError:“ str”对象在python3脚本中没有属性“ read”错误。
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")
尝试一次检查整个文件
user = input("Enter your word : ")
script = open('wordlist.txt', "r")
if user in script.read():
print("Match")
else:
print("Not match")
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句