简体   繁体   English

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

[英]How can I extract information from a recordList returned as node in python using py2neo?

My question is when I have my result as recordList and returned values are nodes then how can I extract information like properties of any particular node from recordList data structure? 我的问题是,当我将结果作为recordList并且返回值是节点时,如何从recordList数据结构中提取信息,例如任何特定节点的属性?

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

Returned: 回来:

(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"})

How can I extract name, sex properties out of returned recordList or Only way is to write cypher that return name and sex of all nodes? 如何从返回的recordList中提取名称,性别属性或唯一方法是编写返回所有节点的名称和性别的密码?

A node has .properties : 节点具有.properties

results = graph.cypher.execute("MATCH (n:Person) RETURN n LIMIT 10")

for row in results:
    properties = row.n.properties
    print(properties['name'])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM