python - why is are my dictionary's values a list of a list -
the procedure below takes list of 'parties' input , calls twitter api followers. result looks like:
{ party1 : [[1,2,3]] party2 : [[e,f,g]] }
but want values simple lists (i.e. [1,2,3], not [[1,2,3]]). guess 'page' pages comes in list, cannot figure out how simpler. have tried .append instead of + below.
edit: noted in comments - page list. code posted below works - wasn't running right version of code. still interested in why .append causes [[.]] appear. i'm okay closing question too.
here code:
def get_party_followers(parties): ids = {} in parties: l=[] page in tweepy.cursor(api.followers_ids, screen_name=i).pages(): l=l+page print "resting" time.sleep(60) ids[i]=l print + " complete" return ids`
Comments
Post a Comment