Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/310.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 为什么会出现“Syntaxwarning对象不可调用;可能缺少逗号”?_Python_Windows_Selenium - Fatal编程技术网

Python 为什么会出现“Syntaxwarning对象不可调用;可能缺少逗号”?

Python 为什么会出现“Syntaxwarning对象不可调用;可能缺少逗号”?,python,windows,selenium,Python,Windows,Selenium,我正试图编写一个程序,从一个网站上监控鞋子的价格,但我得到一个错误,上面写着: 以下是我的程序代码: 从selenium导入webdriver 导入时间 snkrsBot类: 定义初始自我,运动鞋url: self.sneaker\u url=sneaker\u url self.driver=webdriver.Chrome'./chromedriver.exe' def get_priceself: self.driver.getself.sneaker\u url price=self.d

我正试图编写一个程序,从一个网站上监控鞋子的价格,但我得到一个错误,上面写着:

以下是我的程序代码:

从selenium导入webdriver 导入时间 snkrsBot类: 定义初始自我,运动鞋url: self.sneaker\u url=sneaker\u url self.driver=webdriver.Chrome'./chromedriver.exe' def get_priceself: self.driver.getself.sneaker\u url price=self.driver.find_element_by_xpath'//div[@data test=product price]' 返回intprice.get_属性'innerHTML'.strip' def主: url='1〕https://www.nike.com/gb/t/air-max-95-essential-shoe-7hwG30/AT9865-001' bot=snkrsBoturl 最后价格=无 尽管如此: 价格=bot.get\u价格 如果最后价格: 如果价格<上次价格: 打印'价格下降:'上次价格-价格 elif价格>上次价格: 打印“价格上涨:”价格-上次价格 其他: 打印“价格相同”的价格 最后价格=价格 时间到了 你的指纹全错了;错误是告诉您您试图调用str文本,就好像它是一个带参数的函数一样。改为:

        if price < last_price:
            print('Price dropped:', last_price - price)
        elif price > last_price:
            print('Price rose:', price - last_price)
        else:
            print('Price is the same', price) 

我所做的只是添加三个逗号,并删除要打印的值周围的无意义括号

这个问题需要一些清理。你说警告。。。这是一个SyntaxError吗?您的缩进不正确,因此我们不能仅复制/粘贴以进行测试。而且您没有发布实际的回溯消息,该消息包含有价值的信息,例如错误行。请解决这些问题,以便我们能够处理好质量问题。
        if price < last_price:
            print('Price dropped:', last_price - price)
        elif price > last_price:
            print('Price rose:', price - last_price)
        else:
            print('Price is the same', price)