def friends(self,nickname):
total_friends = 0
next_cursor = -1
while next_cursor != 0:
timeline = self.api.friends(nickname,'','','',next_cursor)
#timeline = self.api.friends()
if isinstance(timeline, tuple):
next_cursor = timeline[1]
total_friends += len(timeline[0])
for line in timeline[0]:
self.obj = line
fid = self.getAtt("id")
name = self.getAtt("screen_name")
text = "friends---"+ str(fid) +":"+ name
text = text.encode("gbk")
print text
else:
next_cursor = 0
total_friends += len(timeline)
for line in timeline:
self.obj = line
fid = self.getAtt("id")
name = self.getAtt("screen_name")
text = "friends---"+ str(fid) +":"+ name
text = text.encode("gbk")
print text
问题出来了,文档里说返回结果中会有next_cursor字段,但是调试发现timeline的类型不是tuple,而是。这是怎么回事?
重新调试,在