oldnewstyle

先来两个小常识
import sys

print(sys.version)

a='let\'s go!go'

print(a)

C:\Users\sunqicheng\PycharmProjects\object\venv\Scripts\python.exe C:/Users/sunqicheng/PycharmProjects/object/sysversion.py

3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)]

let's go!go

-------------------------------------------------------------------------------------------------------------

class Oldstyle:

    def __init__(self,name,description):

        self.name=name

        self.description=description

class Newstyle(object):

    def __init__(self,name,description):

        self.name=name

        self.description=description

if __name__=='__main__':

    old=Oldstyle('孙启成','健身')

    print(old)##<__main__.Oldstyle object at 0x00000206D3342710>对象的main方法,是这个类在某个地方拉的一个小屎

    print(type(old))#输出对象的main方法<class '__main__'.Oldstyle'>

    print(dir(old))#这个old对象有这么多内置的方法

    new=Newstyle('齐东兴','型男')

    new2=Newstyle('东兴','型男')

    print(new2)

    print(new)#<__main__.Newstyle object at 0x000002CO5ABF85CO>对象的main方法,是这个类在这个地方拉的一个小屎

    print(type(new))

    print(dir(new))

--------------------------------------------------------------

C:\Users\sunqicheng\PycharmProjects\object\venv\Scripts\python.exe C:/Users/sunqicheng/PycharmProjects/object/oldnewstyle.py

<__main__.Oldstyle object at 0x00000212B87E2828>

<class '__main__.Oldstyle'>

['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'description', 'name']

<__main__.Newstyle object at 0x00000212B87E8390>

<__main__.Newstyle object at 0x00000212B87E85C0>

<class '__main__.Newstyle'>

['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'description', 'name']

Process finished with exit code 0

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 137,402评论 19赞 139
  • 包(lib)、模块(module) 在Python中,存在包和模块两个常见概念。 模块:编写Python代码的py...
    清清子衿木子水心阅读 3,963评论 0赞 27
  • 火车站的所有人都在看那个老大爷。 那个老大爷背着一根大烟杆,拿着一把大剑,手里提着一个满是油渍的黑色袋子,被工作人...
    王大东阅读 334评论 0赞 3
  • 他每天除了吃饭睡觉,就是躺在沙发上玩手机,刷完抖音,玩打牌,逛朋友圈,手机电影。吃完饭,继续保持这个状态,唉!我连...
    心冫東阅读 396评论 0赞 0
  • 01 一早起来跟老公炫耀说: “你知道肚子有肌肉是什么感觉么?就是我走路感觉腰板更直了,很少有赘肉一直颤了,而且昨...
    果然是果然阅读 1,387评论 6赞 3

友情链接更多精彩内容