簡體   English   中英

如何使用py2neo從作為python中的節點返回的recordList中提取信息?

[英]How can I extract information from a recordList returned as node in python using 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中提取名稱,性別屬性或唯一方法是編寫返回所有節點的名稱和性別的密碼?

節點具有.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