类Python中的多个属性

时间:2017-01-22 14:41:49

标签: python oop

class Dog(object):
    species = "mammal"
    def __init__(self, breed, name, color):
        self.breed = breed
        self.name = name

sam = Dog(breed="lab", name="maorian", color="white")

但是,我无法使用“颜色”属性。为什么会这样?

1 个答案:

答案 0 :(得分:1)

您没有在初始化程序中设置它。在self.name = name行之后添加USING PERIODIC COMMIT LOAD CSV WITH HEADERS FROM 'file:///C:/Users/Zo5/Documents/Neo4j/check/import/result1.csv' AS line1 MERGE (p:Person {forename:line1.forename, surname:line1.surname, nationality:line1.nationality, occupation:line1.occupation, title:line1.title})