johnny wrote: > Scope of ids: > When I print "ids", it's always empty string '', as I have intialized > before. That's not what I want. I want the ids to have > str(r['id']).join(',') > > if res: > ids = '' > for r in res['key']: > ids = str(r['id']).join(',') > > print("ids: %s" %(ids)) >
1. You do not need to "initialize" ids. 2. It looks as if res['key'] is empty. 3. Are you sure you don't mean "res[key]"? 4. "ids" and "(ids)" are equivalent. 5. Are you sure you don't want to indent the print statement? James -- http://mail.python.org/mailman/listinfo/python-list