编译时类未显示任何内容..什么可能是原因?

时间:2019-02-28 14:27:17

标签: python atom-editor

当我在ATOM中运行此代码..时,它不显示结果,而只是显示了这一点...知道为什么它在ATOM编辑器中不起作用吗?我试图更改缩进,但仍然没有结果,只是ATOM终端中的纯文本

[Finished in 0.229s] 


class myClass():
    def method1(self):
        print("A class this is number 2 ")

    def method2(self, something):
        print("A class this is number 1 " + something)

def main():
    c = myClass()
    c.method1()
    c.method2("some words here")

    if __name__ == "__main__":
        main()

1 个答案:

答案 0 :(得分:0)

缩进错误,请尝试以下操作:

class myClass():
    def method1(self):
        print("A class this is number 2 ")

    def method2(self, something):
        print("A class this is number 1 " + something)

def main():
    c = myClass()
    c.method1()
    c.method2("some words here")

if __name__ == "__main__":
    main()

输出

A class this is number 2 
A class this is number 1 some words here