饺影 发表于 2022-6-22 21:09:13

请问为啥可以运行,但是不显示啊

simple:
class simple_main():
   
    def logo():
      print("_                               _               _\n"      
            "| |                              (_)               | |   \n"
            "| | ____ __ ___   ___ _ __    ___ _ _ __ ____ __ | | ___ \n"
            "| |/ _ \| '_ ` _ \ / _ \ '_ \/ __| | '_ ` _ \| '_ \| |/ _ \\n"
            " | | (_) | | | | | |__/ | | | \__ \ | | | | | | |_) | |__/\n"
            "|_|\___/|_| |_| |_|\___|_| |_| |___/_|_| |_| |_| .__/|_|\___|\n"
            "                                     | |         \n"
            "                                     |_|         ")

    def txt():
      print("--------------------------------------------------")
      txt = (str(input(">>>")))
      print(txt)


test:
import simple

while True:
      simple.simple_main.logo

为啥啊

wp231957 发表于 2022-6-22 21:11:03

simple.simple_main.logo()
调用不是要有括号吗

ba21 发表于 2022-6-22 21:11:57

simple.simple_main.logo()

logo()调用, logo返回地址

jackz007 发表于 2022-6-22 21:19:21

本帖最后由 jackz007 于 2022-6-22 21:20 编辑

class simple_main():
   
    def logo():
      print("_                               _               _\n"      
            "| |                              (_)               | |   \n"
            "| | ____ __ ___   ___ _ __    ___ _ _ __ ____ __ | | ___ \n"
            "| |/ _ \| '_ ` _ \ / _ \ '_ \/ __| | '_ ` _ \| '_ \| |/ _ \\n"
            " | | (_) | | | | | |__/ | | | \__ \ | | | | | | |_) | |__/\n"
            "|_|\___/|_| |_| |_|\___|_| |_| |___/_|_| |_| |_| .__/|_|\___|\n"
            "                                     | |         \n"
            "                                     |_|         ")

    def txt():
      print("--------------------------------------------------")
      txt = (str(input(">>>")))
      print(txt)

a = simple_main
a . logo()
a . txt()

饺影 发表于 2022-6-23 08:57:58

wp231957 发表于 2022-6-22 21:11
simple.simple_main.logo()
调用不是要有括号吗

az,日常大脑宕机
页: [1]
查看完整版本: 请问为啥可以运行,但是不显示啊