如何使用py2neo从python中作为节点返回的recordList中提取信息?

时间:2016-04-23 11:35:52

标签: python neo4j py2neo

我的问题是,当我将结果作为recordList并且返回的值是节点时,我如何从recordList数据结构中提取任何特定节点的属性等信息?

results = graph.cypher.execute("MATCH (n:Person) return n")
for index in range(len(results)):
        print results[index].n

返回:

(n3:Person {birthday:"17/8/2001",name:"John",sex:"male"})
(n4:Person {birthday:"17/8/2001",name:"John",sex:"male"})
(n5:Person {birthday:"17/8/2001",name:"John",sex:"male"})

如何从返回的recordList中提取名称,性别属性或只有方法是编写返回所有节点的名称和性别的密码?

1 个答案:

答案 0 :(得分:0)

节点有results = graph.cypher.execute("MATCH (n:Person) RETURN n LIMIT 10") for row in results: properties = row.n.properties print(properties['name'])

Makefile