python学习--__str__(self)的使用

class testStr:

     pass

    __str(self)__:

        print("hahhaha")

    pass

   

 test=testStr()

print(test)

 输出结果:

hahahhaha

扫描二维码关注公众号,回复: 4798887 查看本文章

猜你喜欢

转载自blog.csdn.net/visoprkx/article/details/82596304