我是python和Twython的新手,我想获取用户所有关注者的列表,因此我正在使用此代码
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
followers = twitter.get_followers_list(screen_name = "abcd")
for theList in followers:
id = theList[ 0 ]
print id
但是我遇到了错误。这可能是由于最后 3 行。
get_followers_list返回json对象,您可以使用字段的名称从json对象中检索字段,下面是一个相同的示例。
next_cursor = -1
同时(next_cursor(:
搜索 = twitter.get_followers_list(screen_name='abcd',光标=next_cursor(
for result in search['users']:
time_zone =result['time_zone'] if result['time_zone'] != None else "N/A"
print result["name"].encode('utf-8')+ ' '+time_zone.encode('utf-8')
next_cursor = search["next_cursor"]