Discuss / Python / 一个测试

一个测试

Topic source

岁益寒

#1 Created at ... [Delete] [Delete and Lock User]

# -*- coding: utf-8 -*-

class Baller(object):

    def __init__(self, shooting, passing, iq):

        self.shooting = shooting

        self.passing = passing

        self.iq = iq

curry = Baller(100, 99, 99)

print(type(curry) == Baller)

if hasattr(curry, 'shooting'):

    print('Curry\'s shooting: %s' % getattr(curry, 'shooting'))


  • 1

Reply