用这种方法遍历dict为什么不行?

class Person(object):
    def __init__(self,name,gender,birth,**kw):
        self.name=name
        self.gender=gender
        self.birth=birth
        for key in kw:
            self.key=kw[key]


xiaoming = Person('Xiao Ming', 'Male', '1990-1-1', job='Student')


print xiaoming.name
print xiaoming.job



龙信
浏览 1213回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python