我已经尝试过这段代码在python上找到facebook上的朋友的名字,但它不起作用
import facebook token='my token' graph= facebook.GraphAPI(token) profile=graph.get_object("me") #extracting your own profile friends=graph.get_connections("me","friends")['data'] friend_list=[friend['name'] for friend in friends] print friend_list
错误:SyntaxError:调用'print'时缺少括号
试试这个 :)
token = 'mytoken' graph = facebook.GraphAPI(token) profile = graph.get_object("me") friends = graph.get_connections("me", "friends") friend_list = [friend['name'] for friend in friends['data']] print friend_list