OwO233
V2EX  ›  问与答

Python 的条件测试如何判断两个对象所属的类是否相同?

  •  
  •   OwO233 · Sep 7, 2021 · 1489 views
    This topic created in 1888 days ago, the information mentioned may be changed or developed.

    如题。好兄弟们,如果能给个实例就更好了。🌚

    4 replies  •  2021-09-07 15:22:08 +08:00
    ch2
    ch2
    Sep 7, 2021❤️1
    1
    type(a)==type(b)
    coolair
    coolair
    Sep 7, 2021❤️1
    2
    isinstance(a, CLASS) and isinstance(b, CLASS)
    bytesfold
    bytesfold
    Sep 7, 2021❤️1
    3
    issubclass 和 isinstance
    OwO233
    OwO233
    OP
    Sep 7, 2021
    4
    谢谢大佬们。OwO
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2426 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 00:52 · PVG 08:52 · LAX 16:52 · JFK 19:52
    ♥ Do have faith in what you're doing.