Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 类型错误:';str';对象不可调用(请求)_Python_Request_Typeerror - Fatal编程技术网

Python 类型错误:';str';对象不可调用(请求)

Python 类型错误:';str';对象不可调用(请求),python,request,typeerror,Python,Request,Typeerror,每当我尝试此代码时,都会弹出以下错误: TypeError:“str”对象不可调用 有人知道我做错了什么吗?如果是的话,请帮帮我 .text是普通属性,不是函数调用。不要在末尾加括号。这个错误不是随附了更多信息吗?这会检查网站的整个源代码中是否存在这个词吗?因为我不认为它是这样做的,或者我只是瞎了眼?它会检查获取的url的整个文本内容中的单词。但它不会检查类名,对吗?有什么方法可以做到这一点吗?它检查url的整个文本内容,其中包括CSS类名。所以,是的,它检查类名(还有很多其他的东西)。你只想检

每当我尝试此代码时,都会弹出以下错误: TypeError:“str”对象不可调用

有人知道我做错了什么吗?如果是的话,请帮帮我
.text
是普通属性,不是函数调用。不要在末尾加括号。

这个错误不是随附了更多信息吗?这会检查网站的整个源代码中是否存在这个词吗?因为我不认为它是这样做的,或者我只是瞎了眼?它会检查获取的url的整个文本内容中的单词。但它不会检查类名,对吗?有什么方法可以做到这一点吗?它检查url的整个文本内容,其中包括CSS类名。所以,是的,它检查类名(还有很多其他的东西)。你只想检查类名吗?是的,我只想检查类名
import requests

with open('myFile.txt', 'r') as file:
 for line in file:
  for word in line.split():
   link = requests.get(https://google.com)
   word = "balloon"
   if word in link.text():
    print("nice word!")
   else:
    print("bad word!")
if word in link.text():