python第一天

今天,看了一下《简明 Python 教程》。在练习用Python自带的IDE编写函数的时候,按照例子所敲上来,在enter的时候,死活都运行不起来。不是报SyntaxError: invalid syntax就是  File "<pyshell#1>", line 2
    print 'x is',x
        ^
IndentationError: expected an indented block。刚刚学,可能一些细节没有注意到。经过调试了一下,原来写完一个函数,需要空一行,至到它出现>>> 为止。

例如:

def func(x):

   print 'i am ',x

 

>>> x = 'here'

>>> func(x)

i am  here

你可能感兴趣的:(python,ide)