如图,运行只打印出了hello1和hello3 class里的内容不运行。百思不得其答案
你没有调用,当然不会执行了。你要调用类中的方法。
要打印出hello2,你需要将类实例化并调用其方法才行,在ptint('hello3')前写上 t=Testapi(),print(t.testlogin())就可以了。