我已经尝试过这段代码在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
Run Code Online (Sandbox Code Playgroud)
错误:SyntaxError:调用'print'时缺少括号
当我在代码下面运行时,我得到"语法错误:语法无效".但是,如果我在打印后用括号运行此代码,我会得到正确的答案.
liczby = [
951, 402, 984, 651, 360, 69, 408, 319, 601, 485, 980, 507, 725, 547, 544,
615, 83, 165, 141, 501, 263, 617, 865, 575, 219, 390, 984, 592, 236, 105, 942, 941,
386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345,
399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217,
815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 81, 379, …Run Code Online (Sandbox Code Playgroud) 我是一名游戏玩家,他决定要制作其他人可以玩的基本游戏.我对编码非常陌生并且对它有最基本的了解.我的堂兄和我正在尝试在Python 3.6.0中制作基于文本的游戏.我们在互联网上搜索了我们的问题的答案,但找不到任何东西.代码如下:
def start ():
print ''' Welcome to the game! Created by Meme Buddha
type 'start' to begin'''
print
prompt_sta ()
def prompt_sta ():
prompt_0 = input ('Type a Command, ')
try:
if prompt_0 == 'Start':
outside_house ()
elif prompt_0 == 'Begin':
print 'You need to drink bleach and look at spicy memes!'
print
prompt_sta ()
else:
print 'Type Start, throw it on him not me,ugh,lets try something else!'
print
prompt_sta ()
except ValueError:
print 'Type Start, throw it …Run Code Online (Sandbox Code Playgroud) 我使用的是python版本3.5.2,打印功能对我不起作用.这是代码.我接到一个错误说:"在打电话打印时缺少优先权"
print 'Output After Training:'
Run Code Online (Sandbox Code Playgroud)
谢谢