1)直接
print("hello")
2)使用main函数:
def main(): print("Helloa你好") if __name__ == "__main__": main()
3)定义成类成员,用main调用:
class Beauty: def SayHello(self): print("Helllo,你好") def main(): beauty = Beauty() beauty.SayHello() if __name__ == "__main__": main()
1)直接
print("hello")
2)使用main函数:
def main(): print("Helloa你好") if __name__ == "__main__": main()
3)定义成类成员,用main调用:
class Beauty: def SayHello(self): print("Helllo,你好") def main(): beauty = Beauty() beauty.SayHello() if __name__ == "__main__": main()