python函数执行失败
class Person:
def setname(self,name):
self.name = name
def getname(self):
return self.name
def greet(self):
print("hello,world,I am %s" % self.name)
F5执行的时候弹出提示框:expected an indented block.不知道这是什么原因
[解决办法]
帅哥看注释
#!/usr/bin/python
#coding:
#author:
class Person:
def setname(self,name):
self.name = name#此处注意缩进
def getname(self):
return self.name
def greet(self):
print("hello,world,I am %s" % self.name)
if __name__ == '__main__':
pass