这能运行,这样显得繁琐还是简单一点呢
class Person(object):
def __init__(self,**kw):
for k,v in kw.iteritems():
setattr(self,k,v)
xiaoming = Person(name = 'Xiao Ming', gender = 'Male', birth = '1990-1-1', job = 'Student',hobby = 'Like to Swim')
print xiaoming.name,'\n',xiaoming.gender,'\n',xiaoming.birth,'\n',xiaoming.job,'\n',xiaoming.hobby