我正在尝试使用这些文档在 Neo4j python 中制作图表: http://docs.neo4j.org/chunked/snapshot/python-embedded-reference-core.html “允许的属性值包括字符串、数字、 bool 值以及这些基元的数组”。因此,我正在尝试构建一个字符串列表,然后附加该列表。
from neo4j import GraphDatabase
db = GraphDatabase('/home/username/Neo4j/')
with db.transaction:
testNode = db.node()
testNode['stringList'] = ["one","two"]
string_list_edit = testNode['stringList']
string_list_edit.append("three")
给我这个错误:
AttributeError: 'java.lang.String[]' object has no attribute 'append'
这是怎么做到的?
最佳答案
如果您粘贴所有代码,则可以评估它是否存在其他错误。查看文档:http://docs.neo4j.org/chunked/snapshot/python-embedded-reference-core.html
你包括在内吗?
with db.transactions:
在你的代码之前?你必须那样做。另外,试试这个:
testNode['stringList'] = ["one","two"]
string_list_edit = testNode['stringList']
string_list_edit.append("three")
testNode['stringList'] = string_list_edit
关于python - 如何在 Neo4j python-embedded 中附加一个列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10144869/