1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Python Developer

Discussion in 'General Programming Chat' started by alexel, Jul 26, 2016.

Tags:
  1. alexel

    alexel Jr. VIP Jr. VIP

    Joined:
    Feb 20, 2015
    Messages:
    228
    Likes Received:
    68
    Location:
    New York
    Working with ********'s API and I need some help figuring out how to run user defined functions.

    Code:
    # Get the friends list
        def friends(self):
            friends = []
            for friend in self.updates()['result'].get('friends_response', [])['friends']:
                friends.append(friend['name'])
            return friends
    
    When I run it, it only prints the number of friends, I wish for it to print individual names of friends.