Tweepy list_members python

蹲街弑〆低调 提交于 2019-12-03 10:16:05

Each element of the list is a User object, which holds more information about the user than just their name. If you want just the names, do

the_list = [u.screen_name for u in the_list]

after calling api.list_members. Or you can combine the two:

the_list = [u.screen_name for u in api_list_members('username','listname')

or you can extract the names only when you're displaying them:

the_list = api.list_members('username','listname')
for user in the_list:
    print user.screen_name

Incidentally, you should choose a more informative name than the_list. Perhaps user_names or list_members or something.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!