def relationship_top(): for id in TOP_100: print 'analysis id', id sleep(1) for foer in TOP_100: if id != foer and not WeiboUser.get_relation(id, foer)\ and not WeiboUser.get_non_relation(id, foer): print 'analysis', id, 'and', foer, '...' try: e = a.exists_friendship(id,foer) except: continue if e.friends: print id, 'is followed by', foer, 'saving..' WeiboUser.save_relationship(id, foer) else: print id, 'is not followed by', foer, 'saving..' WeiboUser.save_non_relationship(id, foer) sleep(1)