我正在使用Raspberry Pi和tweepy基于鸣叫控制Pi上的GPIO引脚。例如,如果我的推文显示“正在加热”,则会启动一个继电器并开启加热功能。比较关键字与鸣叫gpio激活
我已经设法读取我的推文并将其打印出来,但我似乎无法实现的是将关键词与推文进行比较,然后执行某些操作。任何人都可以指引我走向正确的方向吗?
这是我到目前为止已经试过:
def on_status(self, status)
print (status.text)
tweet_check = unicode(status.text)
print tweet_check
if tweet_check == "heating on":
print "got it" # just to confirm capture
def on_error(self, status):
print status
这是我使用高清on_status(个体经营,状态)的代码: 打印(status.text) tweet_check =的Unicode(status.text) 打印tweet_check 如果tweet_check == “猫”: 打印“了它“ 返回True –
请将您的代码添加到您的文章中,而不是在评论中。我建议你看看[tour](http://stackoverflow.com/tour)。 –
对不起julien lopez –