>>> x=5
>>> y=10
>>> if(x>y):
... print 'x is greater':
File "<stdin>", line 2
print 'x is greater':
^
IndentationError: expected an indented block
答案 0 :(得分:0)
错误消息说明了一切。 Python使用缩进来处理块,并且因为print
语句应该在if
块内,所以它应该缩进:
>>> x=5
>>> y=10
>>> if(x>y):
... print 'x is greater': # Note the indentation here