【发布时间】:2015-04-18 16:17:56
【问题描述】:
我正在尝试在应用程序中编写一些代码,以检查用户是否关注您。我只想让代码返回一个可以放入 if 循环的 True/False 值。
代码是:
user_id = '1234567890'
print api.show_friendship(target_id=user_id)
它返回所有这些 JSON,我对此一无所知,但想要“following”下其他用户的第二个数组中的“false”值(或者,“followed_by”下第一个数组中的 true/false '...无论哪种方式都可以!):
{"relationship":{"source":{"id":0000000000,"id_str":"0000000000","screen_name":"auth_user","following":false,"followed_by":false,"following_received":false,"following_requested":false,"notifications_enabled":false,"can_dm":false,"blocking":false,"blocked_by":false,"muting":false,"want_retweets":false,"all_replies":false,"marked_spam":false},"target":{"id":123456789,"id_str":"123456789","screen_name":"other_user","following":false,"followed_by":false,"following_received":false,"following_requested":false}}}
如何让我的代码为“以下”:false 部分返回真/假?
(或者,第一个数组中的 "followed_by":false 部分 - 每个数组都来自用户对关系的“观点”)
【问题讨论】:
标签: python arrays json twitter tweepy