NameError:名称'process_or_store'未定义,python

时间:2015-11-10 16:22:50

标签: python twitter tweepy

我尝试执行此代码,但收到此错误消息:

  

NameError:未定义名称“process_or_store”,

我在这里尝试了所有相关解决方案但没有任何效果。我怎样才能摆脱错误信息?

import tweepy
import json
import nltk

from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener



consumer_key = 'key'
consumer_secret = 'secret'
access_token = '-token'
access_secret = 'secret'

auth = OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_secret)

api = tweepy.API(auth)

for status in tweepy.Cursor(api.home_timeline).items(10):
    # Process a single status
     process_or_store(status.json)

3 个答案:

答案 0 :(得分:2)

如R Nar所述,process_or_store方法尚未定义。您可以详细了解如何执行此操作here

As explained by the author

  

函数process_or_store()是自定义实现的占位符。

答案 1 :(得分:1)

我认为这就是你要找的 -

std::cin >> a >> b;

在使用此代码块之前,不要忘记将simplejson导入为json。这可以在你提到的网站上找到。

答案 2 :(得分:1)

使用: 打印(json.dumps(friend._json))

取代

process_or_store(friend._json)