for loop returning the last object not the preceding ones python
Question: 
    def excel(vendor_ids):
        for i in vendor_ids:
            t = Test()
            c = pycurl.Curl()
            c.setopt(c.URL, (str("https://api.box.com/2.0/folders/%s")%(i)))
            c.setopt(pycurl.HTTPHEADER, ['Authorization: Bearer %s'%(access_token)])
            c.setopt(c.WRITEFUNCTION, t.body_callback)
            c.perform()
            c.close()
            contents=(t.contents)
            #print(contents)
            jsondict=(json.JSONDecoder().decode(contents))
            collect=(jsondict['item_collection'])
            ids= (collect['entries'])
            dic=[]
            for k in ids:
                print(k)
                return k 
    
    
    K=excel(vendor_ids)
    

when i print the following print but when i return i only get the last one

    
    
    {u'sequence_id': u'0', u'etag': u'0', u'type': u'folder', u'id': u'4322345554', u'name': u'rejected'}
    {u'sequence_id': u'0', u'etag': u'0', u'type': u'folder', u'id': u'4392281882', u'name': u'incoming'}
    {u'sequence_id': u'0', u'etag': u'0', u'type': u'folder', u'id': u'4392284514', u'name': u'rejected'}
    {u'sequence_id': u'0', u'etag': u'0', u'type': u'folder', u'id': u'4866336745', u'name': u'imports'}
    {u'sequence_id': u'0', u'etag': u'0', u'type': u'folder', u'id': u'4912855065', u'name': u'Incoming'}
    {u'sequence_id': u'0', u'etag': u'0', u'type': u'folder', u'id': u'4912855189', u'name': u'Rejected'}
    


Answer: What you can do is to store your data to a list and return at the end.
Something like this:

    
    
    lst=[]   
    for k in ids:
        print(k)
        lst.append(k)
    return lst 
    

But your outer loop still iterate only once, i can't really understand your
code and use case, but you could use `yield` instead of `return` if you have
`generator` concept and matches your use case.

