Invaild语法Python内部打印2.7.11
好的,所以在打印函数中是一个错误。我似乎无法摆脱这是我的代码:Invaild语法Python内部打印2.7.11,python,python-2.7,error-handling,syntax,Python,Python 2.7,Error Handling,Syntax,好的,所以在打印函数中是一个错误。我似乎无法摆脱这是我的代码: def chaselect(): print ''' Now you must choose your race ''' while player.race == None: ace = raw_input(''' 1. Human 2. Elf 3. Dwarf 4. Orc ''')) if ace == '1': print 'You chose h
def chaselect():
print '''
Now you must choose your race '''
while player.race == None:
ace = raw_input('''
1. Human
2. Elf
3. Dwarf
4. Orc
'''))
if ace == '1':
print 'You chose human are you sure?'
con = raw_input('''
1. Confirm Race
2. Read Lore
3. Go Back
'''))
这是Python2.7.11,所以我不需要打印('e.g')
现在发生的是打印内部发生语法错误?
我该如何解决这个问题?为什么会出现这个错误?试试这个:
def chaselect():
print 'Now you must choose your race '
while player.race == None:
ace = raw_input('1. Human \n2. Elf \n3. Dwarf \n4. Orc\n')
if ace == '1':
print 'You chose human are you sure?'
con = raw_input('\n1. Confirm Race\n2. Read Lore\n3. Go Back')
输入函数的括号太多
def chaselect():
print '''
Now you must choose your race '''
while player.race == None:
ace = raw_input('''
1. Human
2. Elf
3. Dwarf
4. Orc
''')
if ace == '1':
print 'You chose human are you sure?'
con = raw_input('''
1. Confirm Race
2. Read Lore
3. Go Back
''')
我认为你应该使用IDE(比如PyCharm,WingIDE)。
这些编辑器将捕获您的输入错误。请添加错误文本。定义var player.race的位置?每个原始输入都有一个额外的右括号